mirror of
https://git.yoctoproject.org/poky
synced 2026-02-21 17:09:42 +01:00
Details of changes [1] [1] https://sourceware.org/pipermail/binutils/2022-August/122246.html (From OE-Core rev: a2458d4011e77868d6384b377a7a4cc1096c4ac3) (From OE-Core rev: 4fa90ce4f13eb8a854836462b1865fd08f5a68b2) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
76 lines
2.7 KiB
Diff
76 lines
2.7 KiB
Diff
From a0ac147aec127c66c9e38292faa50bb56d3c2a19 Mon Sep 17 00:00:00 2001
|
|
From: Khem Raj <raj.khem@gmail.com>
|
|
Date: Mon, 2 Mar 2015 01:58:54 +0000
|
|
Subject: [PATCH] binutils-crosssdk: Generate relocatable SDKs
|
|
|
|
This patch will modify the ELF linker scripts so that the crosssdk
|
|
linker will generate binaries with a 4096 bytes PT_INTERP section. When the binaries
|
|
will be relocated, at SDK install time, the interpreter path can be easily
|
|
changed by the relocating script.
|
|
|
|
generate larger .interp section for gold linker as well
|
|
|
|
Upstream-Status: Inappropriate [SDK specific]
|
|
|
|
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
|
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
---
|
|
gold/layout.cc | 2 +-
|
|
ld/genscripts.sh | 3 +++
|
|
ld/scripttempl/elf.sc | 4 ++--
|
|
3 files changed, 6 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/gold/layout.cc b/gold/layout.cc
|
|
index 3efe8d98ae9..9cc389664a6 100644
|
|
--- a/gold/layout.cc
|
|
+++ b/gold/layout.cc
|
|
@@ -5033,7 +5033,7 @@ Layout::create_interp(const Target* target)
|
|
gold_assert(interp != NULL);
|
|
}
|
|
|
|
- size_t len = strlen(interp) + 1;
|
|
+ size_t len = 4096;
|
|
|
|
Output_section_data* odata = new Output_data_const(interp, len, 1);
|
|
|
|
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
|
|
index 278f212bdad..0c52ebee4d0 100755
|
|
--- a/ld/genscripts.sh
|
|
+++ b/ld/genscripts.sh
|
|
@@ -304,6 +304,7 @@ DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}"
|
|
LD_FLAG=r
|
|
DATA_ALIGNMENT=${DATA_ALIGNMENT_r}
|
|
DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
|
|
+PARTIAL_LINKING=" "
|
|
( echo "/* Script for -r */"
|
|
source_sh ${CUSTOMIZER_SCRIPT}
|
|
source_sh ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
|
|
@@ -312,10 +313,12 @@ DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
|
|
LD_FLAG=u
|
|
DATA_ALIGNMENT=${DATA_ALIGNMENT_u}
|
|
CONSTRUCTING=" "
|
|
+PARTIAL_LINKING=" "
|
|
( echo "/* Script for -Ur */"
|
|
source_sh ${CUSTOMIZER_SCRIPT}
|
|
source_sh ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
|
|
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xu
|
|
+unset PARTIAL_LINKING
|
|
|
|
DATA_ALIGNMENT=${DATA_ALIGNMENT_}
|
|
RELOCATING=" "
|
|
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
|
|
index bf2268bb0ad..b1811ef130f 100644
|
|
--- a/ld/scripttempl/elf.sc
|
|
+++ b/ld/scripttempl/elf.sc
|
|
@@ -148,8 +148,8 @@ if test -z "$DATA_SEGMENT_ALIGN"; then
|
|
DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
|
|
fi
|
|
fi
|
|
-if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
|
|
- INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
|
|
+if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}${PARTIAL_LINKING}"; then
|
|
+ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = 0x1000; }"
|
|
fi
|
|
if test -z "$PLT"; then
|
|
IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
|