v850: improve linker scripts for relocatable linking

Quite a few constructs where unconditional when they should take
$RELOCATING into account. The original observation was that output of
"ld -r" had .text start at 0x00100000.
This commit is contained in:
Jan Beulich
2025-03-07 08:29:20 +01:00
parent 3e14570494
commit b6b2252830
2 changed files with 14 additions and 14 deletions

View File

@@ -26,7 +26,7 @@ SECTIONS
/* This saves a little space in the ELF file, since the zda starts
at a higher location that the ELF headers take up. */
.zdata ${ZDATA_START_ADDR} :
.zdata ${RELOCATING+${ZDATA_START_ADDR}} :
{
*(.zdata)
${RELOCATING+*(.zbss)
@@ -40,7 +40,7 @@ SECTIONS
section. Specifically it prevents the zdata
section from being marked READONLY. */
.rozdata ${ROZDATA_START_ADDR} :
.rozdata ${RELOCATING+${ROZDATA_START_ADDR}} :
{
*(.rozdata)
${RELOCATING+*(romzdata)
@@ -48,7 +48,7 @@ SECTIONS
}
/* Read-only sections, merged into text segment. */
. = ${TEXT_START_ADDR};
${RELOCATING+. = ${TEXT_START_ADDR};}
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
@@ -95,7 +95,7 @@ SECTIONS
It contains a small lookup table at the start followed by the
code pointed to by entries in the lookup table. */
.call_table_data ${CALL_TABLE_START_ADDR} :
.call_table_data ${RELOCATING+${CALL_TABLE_START_ADDR}} :
{
${RELOCATING+PROVIDE(__ctbp = .);}
*(.call_table_data)
@@ -144,7 +144,7 @@ SECTIONS
.got : {${RELOCATING+ *(.got.plt)} *(.got) }
.dynamic : { *(.dynamic) }
.tdata ${TDATA_START_ADDR} :
.tdata ${RELOCATING+${TDATA_START_ADDR}} :
{
${RELOCATING+PROVIDE (__ep = .);
*(.tbyte)
@@ -158,14 +158,14 @@ SECTIONS
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
.sdata ${SDATA_START_ADDR} :
.sdata ${RELOCATING+${SDATA_START_ADDR}} :
{
${RELOCATING+PROVIDE (__gp = . + 0x8000);}
*(.sdata)
}
/* See comment about .rozdata. */
.rosdata ${ROSDATA_START_ADDR} :
.rosdata ${RELOCATING+${ROSDATA_START_ADDR}} :
{
*(.rosdata)
}

View File

@@ -26,7 +26,7 @@ SECTIONS
/* This saves a little space in the ELF file, since the zda starts
at a higher location that the ELF headers take up. */
.zdata ${ZDATA_START_ADDR} :
.zdata ${RELOCATING+${ZDATA_START_ADDR}} :
{
*(.zdata)
${RELOCATING+*(.zdata23)
@@ -42,7 +42,7 @@ SECTIONS
section. Specifically it prevents the zdata
section from being marked READONLY. */
.rozdata ${ROZDATA_START_ADDR} :
.rozdata ${RELOCATING+${ROZDATA_START_ADDR}} :
{
*(.rozdata)
${RELOCATING+*(romzdata)
@@ -52,7 +52,7 @@ SECTIONS
}
/* Read-only sections, merged into text segment. */
. = ${TEXT_START_ADDR};
${RELOCATING+. = ${TEXT_START_ADDR};}
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
@@ -99,7 +99,7 @@ SECTIONS
It contains a small lookup table at the start followed by the
code pointed to by entries in the lookup table. */
.call_table_data ${CALL_TABLE_START_ADDR} :
.call_table_data ${RELOCATING+${CALL_TABLE_START_ADDR}} :
{
${RELOCATING+PROVIDE(__ctbp = .);}
*(.call_table_data)
@@ -154,7 +154,7 @@ SECTIONS
.got : {${RELOCATING+ *(.got.plt)} *(.got) }
.dynamic : { *(.dynamic) }
.tdata ${TDATA_START_ADDR} :
.tdata ${RELOCATING+${TDATA_START_ADDR}} :
{
${RELOCATING+PROVIDE (__ep = .);
*(.edata)
@@ -174,7 +174,7 @@ SECTIONS
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
.sdata ${SDATA_START_ADDR} :
.sdata ${RELOCATING+${SDATA_START_ADDR}} :
{
${RELOCATING+PROVIDE (__gp = . + 0x8000);}
*(.sdata)
@@ -182,7 +182,7 @@ SECTIONS
}
/* See comment about .rozdata. */
.rosdata ${ROSDATA_START_ADDR} :
.rosdata ${RELOCATING+${ROSDATA_START_ADDR}} :
{
*(.rosdata)
${RELOCATING+*(.sconst)