binutils-crossdk: Fix interp size expansion
PATCH 1/1 binutils-crossdk: Fix interp size expansion
Currently for sdk binutils we expand the size of .interp section to 0x1000 assuming that its at the beginning of the linker map but there may be program header before that so actually we want to add 0x1000 - sizeof(.interp) section to current location and not assign is absolutely to 0x1000
This fixes errors like
built in linker script:11 cannot move location counter backwards (from 0000000000401054 to 0000000000401000)
--- .../binutils/binutils-crosssdk_2.22.bb | 2 +- .../binutils/binutils/relocatable_sdk.patch | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
meta/recipes-devtools/binutils/binutils-crosssdk_2.22.bb +1 -1
@@ -2,7 +2,7 @@ require binutils-cross_${PV}.bb inherit crosssdk -PR = "r1" +PR = "r2" PROVIDES = "virtual/${TARGET_PREFIX}binutils-crosssdk"
meta/recipes-devtools/binutils/binutils/relocatable_sdk.patch +5 -5
@@ -7,16 +7,16 @@ by the relocating script. Signed-off-by: Laurentiu Palcu <[email protected]> -Index: binutils-2.22/ld/scripttempl/elf.sc +Index: git/ld/scripttempl/elf.sc =================================================================== ---- binutils-2.22.orig/ld/scripttempl/elf.sc -+++ binutils-2.22/ld/scripttempl/elf.sc -@@ -116,7 +116,7 @@ if test -n "${COMMONPAGESIZE}"; then +--- git.orig/ld/scripttempl/elf.sc 2012-10-01 21:42:18.729294685 -0700 ++++ git/ld/scripttempl/elf.sc 2012-10-01 22:26:35.149173335 -0700 +@@ -125,7 +125,7 @@ DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);" fi if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then - INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }" -+ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = 0x1000; }" ++ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = (. & 0x1000) + 0x1000; }" fi if test -z "$PLT"; then IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
Signature · 1 line
1.7.9.5
i need to check it with 1 more case. Please hold on for applying it. I welcome testing
Quoted 59 lines · Khem Raj
Currently for sdk binutils we expand the size of .interp section to
0x1000assuming that its at the beginning of the linker map but there may be program header before that so actually we want to add0x1000- sizeof(.interp) section to current location and not assign is absolutely to0x1000This fixes errors like
built in linker script:11 cannot move location counter backwards (from 0000000000401054 to 0000000000401000)
Signed-off-by Khem Raj <[email protected]>--- .../binutils/binutils-crosssdk_2.22.bb | 2 +- .../binutils/binutils/relocatable_sdk.patch | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)meta/recipes-devtools/binutils/binutils-crosssdk_2.22.bb +1
-1@@ -2,7 +2,7 @@ require binutils-cross_${PV}.bb inherit crosssdk -PR = "r1" +PR = "r2" PROVIDES = "virtual/${TARGET_PREFIX}binutils-crosssdk"meta/recipes-devtools/binutils/binutils/relocatable_sdk.patch +5
-6@@ -7,16 +7,16 @@ by the relocating script. Signed-off-by: Laurentiu Palcu <[email protected]> -Index: binutils-2.22/ld/scripttempl/elf.sc +Index: git/ld/scripttempl/elf.sc =================================================================== ---- binutils-2.22.orig/ld/scripttempl/elf.sc -+++ binutils-2.22/ld/scripttempl/elf.sc -@@ -116,7 +116,7 @@ if test -n "${COMMONPAGESIZE}"; then +--- git.orig/ld/scripttempl/elf.sc 2012-10-01 21:42:18.729294685 -0700 ++++ git/ld/scripttempl/elf.sc 2012-10-01 22:26:35.149173335 -0700 +@@ -125,7 +125,7 @@ DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);" fi if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then - INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }" -+ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = 0x1000; }" ++ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = (. & 0x1000) + 0x1000; }" fi if test -z "$PLT"; then IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }" --1.7.9.5
Quoted 9 lines · Khem Raj
i need to check it with 1 more case. Please hold on for applying it. I welcome testing
Quoted 5 lines · Khem Raj
Currently for sdk binutils we expand the size of .interp section to
0x1000assuming that its at the beginning of the linker map but there may be program header before that so actually we want to add0x1000- sizeof(.interp) section to current location and not assign is absolutely to0x1000
Why does it matter if there is another program header before .interp? The .interp section should start at the end of the previous section.
Quoted 5 lines
Quoted 5 lines
This fixes errors like
built in linker script:11 cannot move location counter backwards (from 0000000000401054 to 0000000000401000)
This error usually means that the data inside that section exceeds the allocated size of the section. Assuming .interp section is the first, the linker is trying to squeeze 0x1054 bytes in a 0x1000 bytes section. And that is kind of weird. We might be missing something here...
Quoted 28 lines
Quoted 28 lines
Signed-off-by Khem Raj <[email protected]>--- .../binutils/binutils-crosssdk_2.22.bb | 2 +- .../binutils/binutils/relocatable_sdk.patch | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)meta/recipes-devtools/binutils/binutils-crosssdk_2.22.bb +1
-1@@ -2,7 +2,7 @@ require binutils-cross_${PV}.bb inherit crosssdk -PR = "r1" +PR = "r2" PROVIDES = "virtual/${TARGET_PREFIX}binutils-crosssdk"meta/recipes-devtools/binutils/binutils/relocatable_sdk.patch +0
-0@@ -7,16 +7,16 @@ by the relocating script. Signed-off-by: Laurentiu Palcu <[email protected]>
Quoted 15 lines
Quoted 5 lines
meta/recipes-devtools/binutils/binutils/relocatable_sdk.patch +1
-3-Index: binutils-2.22/ld/scripttempl/elf.sc +Index: git/ld/scripttempl/elf.sc =================================================================== ---- binutils-2.22.orig/ld/scripttempl/elf.sc -+++ binutils-2.22/ld/scripttempl/elf.scmeta/recipes-devtools/binutils/binutils/relocatable_sdk.patch by the relocating script. · line 19
Quoted 10 lines
meta/recipes-devtools/binutils/binutils/relocatable_sdk.patch +4
-2-@@ -116,7 +116,7 @@ if test -n "${COMMONPAGESIZE}"; then +--- git.orig/ld/scripttempl/elf.sc 2012-10-01 21:42:18.729294685 -0700 ++++ git/ld/scripttempl/elf.sc 2012-10-01 22:26:35.149173335 -0700 +@@ -125,7 +125,7 @@ DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);" fi if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then - INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }" -+ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = 0x1000; }" ++ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = (. & 0x1000) + 0x1000; }"
This line confuses me. You will have here an .interp size of 0x1000 or 0x2000. Is this the intent?
Thanks,
Laurentiu
Quoted 12 lines
Quoted 6 lines
meta/recipes-devtools/binutils/binutils/relocatable_sdk.patch +0
-1fi if test -z "$PLT"; then IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }" --1.7.9.5
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Quoted 4 lines · Khem Raj
i need to check it with 1 more case. Please hold on for applying it. I welcome testing
I tried 'bitbake meta-toolchain' with poky danny branch.
Your patch fixes the following eror in nativesdk-eglibc-2.16-r15+svnr20393
built in linker script:11 cannot move location counter backwards (from 0000000000401048 to 0000000000401000)
collect2: error: ld returned 1 exit status
But now I get:
..tmp/work/x86_64-nativesdk-pokysdk-linux/ nativesdk-qemu-1.2.0-r3/qemu-1.2.0/x86_64.ld:9 cannot move location counter backwards (from 0000000060001048
to 0000000060001000)
collect2: error: ld returned 1 exit status