Skip to content

Commit

Permalink
Move the gp register, to allow the compiler to leverage gp to access …
Browse files Browse the repository at this point in the history
…the first part of ram. This produces smaller executables in general. I don't know why the original startup code pointed at 0x20000800. You can reach all of the first part of ram by setting it to 0x200003fc
  • Loading branch information
cnlohr committed Feb 23, 2025
1 parent 5b5baff commit 3365fc1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ch32fun/ch32fun.ld
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ SECTIONS
.data :
{
. = ALIGN(4);
__global_pointer$ = . + 0x3fc; /* This gets set in the startup code. This allows -mrelax'd code to be smaller by acting as a sort of quick reference in the gp register. */
*(.gnu.linkonce.r.*)
*(.data .data.*)
*(.gnu.linkonce.d.*)
. = ALIGN(8);
PROVIDE( __global_pointer$ = . + 0x800 );
*(.sdata .sdata.*)
*(.sdata2*)
*(.gnu.linkonce.s.*)
Expand Down

0 comments on commit 3365fc1

Please sign in to comment.