[binutils-gdb] v850: improve linker scripts for relocatable linking
Jan Beulich
jbeulich@sourceware.org
Fri Mar 7 07:32:06 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b6b2252830dc0431c82aee695055acfb7f341722
commit b6b2252830dc0431c82aee695055acfb7f341722
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri Mar 7 08:29:20 2025 +0100
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.
Diff:
---
ld/scripttempl/v850.sc | 14 +++++++-------
ld/scripttempl/v850_rh850.sc | 14 +++++++-------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/ld/scripttempl/v850.sc b/ld/scripttempl/v850.sc
index d005818627d..c7f79216e9c 100644
--- a/ld/scripttempl/v850.sc
+++ b/ld/scripttempl/v850.sc
@@ -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)
}
diff --git a/ld/scripttempl/v850_rh850.sc b/ld/scripttempl/v850_rh850.sc
index cfe25d2001b..ad27769989f 100644
--- a/ld/scripttempl/v850_rh850.sc
+++ b/ld/scripttempl/v850_rh850.sc
@@ -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)
More information about the Binutils-cvs
mailing list