sparc-linux-user: Fix missing symbols in .rel/.rela.plt sections
PATCH 1/1 sparc-linux-user: Fix missing symbols in .rel/.rela.plt sections
Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols __rel_iplt_start and __rel_iplt_end around .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (using STT_GNU_IFUNC).
Blue Swirl <[email protected]>
--- sparc.ld | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-)
sparc.ld +14 -2
@@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE_HIDDEN (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE_HIDDEN (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE_HIDDEN (__rela_iplt_start = .); + *(.rela.iplt) + PROVIDE_HIDDEN (__rela_iplt_end = .); + } .init : { *(.init) } =0x47ff041f .text : {
Signature · 1 line
1.7.7.3
Quoted 26 lines · Aurelien Jarno
Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols
__rel_iplt_startand__rel_iplt_endaround .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (usingSTT_GNU_IFUNC).Blue Swirl <[email protected]>
Signed-off-by Aurelien Jarno <[email protected]>---
sparc.ld | 16 ++++++++++++++--1 files changed, 14 insertions(+), 2 deletions(-)sparc.ld +4
-2@@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE_HIDDEN (__rel_iplt_start = .);
sparc.ld SECTIONS · line 53
Quoted 10 lines
sparc.ld +10
-0+ *(.rel.iplt) + PROVIDE_HIDDEN (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE_HIDDEN (__rela_iplt_start = .); + *(.rela.iplt) + PROVIDE_HIDDEN (__rela_iplt_end = .); + }
PROVIDE_HIDDEN etc. were removed by 8733f6093c2b77502e7228503fc22024e51599b8 in order to support BSDs with older binutils (2.15). Maybe the ld scripts should be generated from a source file for example with CPP, so these lines could be tweaked.
Doesn't guest base make the whole ld script thing useless? It's not implemented for Sparc though.
Quoted 7 lines
.init : { *(.init) } =0x47ff041f
.text :
{
--
1.7.7.3
Quoted 34 lines · Blue Swirl
Quoted 33 lines · Aurelien Jarno
Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols
__rel_iplt_startand__rel_iplt_endaround .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (usingSTT_GNU_IFUNC).Blue Swirl <[email protected]>
Signed-off-by Aurelien Jarno <[email protected]>---
sparc.ld | 16 ++++++++++++++--1 files changed, 14 insertions(+), 2 deletions(-)sparc.ld +11
-2@@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE_HIDDEN (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE_HIDDEN (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE_HIDDEN (__rela_iplt_start = .);
Quoted 9 lines
sparc.ld SECTIONS · line 53
Quoted 3 lines
sparc.ld +3
-0+ *(.rela.iplt) + PROVIDE_HIDDEN (__rela_iplt_end = .); + }
PROVIDE_HIDDENetc. were removed by8733f6093c2b77502e7228503fc22024e51599b8in order to support BSDs with older binutils (2.15). Maybe the ld scripts should be generated from a source file for example with CPP, so these lines could be tweaked.
It seems this patch was in my local tree for too long, and it seems I should have updated it before sending it...
Other architectures are now using PROVIDE instead of PROVIDE_HIDDEN for __rel{a,}_iplt_{start,end}, so I guess the same can be done for sparc and ppc. I am going to do a test build to check that, and I'll come with a new patch if it works.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 45 lines · Aurelien Jarno
Quoted 34 lines · Blue Swirl
Quoted 33 lines · Aurelien Jarno
Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols
__rel_iplt_startand__rel_iplt_endaround .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (usingSTT_GNU_IFUNC).Blue Swirl <[email protected]>
Signed-off-by Aurelien Jarno <[email protected]>---
sparc.ld | 16 ++++++++++++++--1 files changed, 14 insertions(+), 2 deletions(-)sparc.ld +11
-2@@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE_HIDDEN (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE_HIDDEN (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE_HIDDEN (__rela_iplt_start = .);Quoted 9 lines
sparc.ld SECTIONS · line 53
Quoted 3 lines
sparc.ld +3
-0+ *(.rela.iplt) + PROVIDE_HIDDEN (__rela_iplt_end = .); + }
PROVIDE_HIDDENetc. were removed by8733f6093c2b77502e7228503fc22024e51599b8in order to support BSDs with older binutils (2.15). Maybe the ld scripts should be generated from a source file for example with CPP, so these lines could be tweaked.
Quoted 7 lines
It seems this patch was in my local tree for too long, and it seems I should have updated it before sending it...
Other architectures are now using PROVIDE instead of
PROVIDE_HIDDENfor __rel{a,}_iplt_{start,end}, so I guess the same can be done for sparc and ppc. I am going to do a test build to check that, and I'll come with a new patch if it works.
The new patch below also fixes the issue, and uses PROVIDE instead of PROVIDE_HIDDEN.
sparc-linux-user: Fix missing symbols in .rel/.rela.plt sections
Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols __rel_iplt_start and __rel_iplt_end around .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (using STT_GNU_IFUNC).
--- sparc.ld | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-)
sparc.ld +14 -2
@@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE (__rela_iplt_start = .); + *(.rela.iplt) + PROVIDE (__rela_iplt_end = .); + } .init : { *(.init) } =0x47ff041f .text : {
Signature · 6 lines
1.7.7.3 -- Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 49 lines · Aurelien Jarno
Quoted 48 lines · Aurelien Jarno
Quoted 34 lines · Blue Swirl
Quoted 33 lines · Aurelien Jarno
Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols
__rel_iplt_startand__rel_iplt_endaround .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (usingSTT_GNU_IFUNC).Blue Swirl <[email protected]>
Signed-off-by Aurelien Jarno <[email protected]>---
sparc.ld | 16 ++++++++++++++--1 files changed, 14 insertions(+), 2 deletions(-)sparc.ld +11
-2@@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE_HIDDEN (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE_HIDDEN (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE_HIDDEN (__rela_iplt_start = .);Quoted 9 lines
sparc.ld SECTIONS · line 53
Quoted 3 lines
sparc.ld +3
-0+ *(.rela.iplt) + PROVIDE_HIDDEN (__rela_iplt_end = .); + }
PROVIDE_HIDDENetc. were removed by8733f6093c2b77502e7228503fc22024e51599b8in order to support BSDs with older binutils (2.15). Maybe the ld scripts should be generated from a source file for example with CPP, so these lines could be tweaked.It seems this patch was in my local tree for too long, and it seems I should have updated it before sending it...
Quoted 7 lines
Quoted 4 lines
Other architectures are now using PROVIDE instead of
PROVIDE_HIDDENfor __rel{a,}_iplt_{start,end}, so I guess the same can be done for sparc and ppc. I am going to do a test build to check that, and I'll come with a new patch if it works.The new patch below also fixes the issue, and uses PROVIDE instead of
PROVIDE_HIDDEN.
This should work, the info page for OpenBSD ld talks about PROVIDE (but not PROVIDE_HIDDEN).
Quoted 49 lines
sparc-linux-user: Fix missing symbols in .rel/.rela.plt sections
Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols
__rel_iplt_startand__rel_iplt_endaround .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (usingSTT_GNU_IFUNC).Cc Blue Swirl <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>---
sparc.ld | 16 ++++++++++++++--1 files changed, 14 insertions(+), 2 deletions(-)sparc.ld +14
-2@@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE (__rela_iplt_start = .); + *(.rela.iplt) + PROVIDE (__rela_iplt_end = .); + }.init : { *(.init) } =0x47ff041f
.text :
{
--
1.7.7.3--
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
This patch was submitted more than a year ago (at Jan-2012). Is it still needed? If yes, why it hasn't been applied?
It still applies cleanly to the current git, with the exception of s|^|ldscripts/| - sparc.ld moved from the top directory to ldscripts/.
(Ref: http://patchwork.ozlabs.org/patch/135267 )
Thanks,
/mjt
Quoted 43 lines · Aurelien Jarno
sparc-linux-user: Fix missing symbols in .rel/.rela.plt sections
Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols
__rel_iplt_startand__rel_iplt_endaround .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (usingSTT_GNU_IFUNC).Cc Blue Swirl <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>---
sparc.ld | 16 ++++++++++++++--1 files changed, 14 insertions(+), 2 deletions(-)sparc.ld +14
-2@@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE (__rela_iplt_start = .); + *(.rela.iplt) + PROVIDE (__rela_iplt_end = .); + } .init : { *(.init) } =0x47ff041f .text : {
Ping #2?
Quoted 60 lines · Michael Tokarev
This patch was submitted more than a year ago (at Jan-2012). Is it still needed? If yes, why it hasn't been applied?
It still applies cleanly to the current git, with the exception of s|^|ldscripts/| - sparc.ld moved from the top directory to ldscripts/.
(Ref: http://patchwork.ozlabs.org/patch/135267 )
Thanks,
/mjt
Quoted 43 lines · Aurelien Jarno
sparc-linux-user: Fix missing symbols in .rel/.rela.plt sections
Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols
__rel_iplt_startand__rel_iplt_endaround .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (usingSTT_GNU_IFUNC).Cc Blue Swirl <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>---
sparc.ld | 16 ++++++++++++++--1 files changed, 14 insertions(+), 2 deletions(-)sparc.ld +14
-2@@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE (__rela_iplt_start = .); + *(.rela.iplt) + PROVIDE (__rela_iplt_end = .); + } .init : { *(.init) } =0x47ff041f .text : {
Quoted 5 lines · Michael Tokarev
Ping #2?
Quoted 2 lines · Michael Tokarev
This patch was submitted more than a year ago (at Jan-2012). Is it still needed? If yes, why it hasn't been applied?
Well, is it still needed?
Quoted 59 lines
Quoted 58 lines
It still applies cleanly to the current git, with the exception of s|^|ldscripts/| - sparc.ld moved from the top directory to ldscripts/.
(Ref: http://patchwork.ozlabs.org/patch/135267 )
Thanks,
/mjt
Quoted 43 lines · Aurelien Jarno
sparc-linux-user: Fix missing symbols in .rel/.rela.plt sections
Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols
__rel_iplt_startand__rel_iplt_endaround .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (usingSTT_GNU_IFUNC).Cc Blue Swirl <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>---
sparc.ld | 16 ++++++++++++++--1 files changed, 14 insertions(+), 2 deletions(-)sparc.ld +14
-2@@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE (__rela_iplt_start = .); + *(.rela.iplt) + PROVIDE (__rela_iplt_end = .); + } .init : { *(.init) } =0x47ff041f .text : {
Quoted 8 lines · Blue Swirl
Quoted 5 lines · Michael Tokarev
Ping #2?
Quoted 2 lines · Michael Tokarev
This patch was submitted more than a year ago (at Jan-2012). Is it still needed? If yes, why it hasn't been applied?
Well, is it still needed?
Without it, trying to build static qemu-user on sparc leads to the following error:
| LINK mips-linux-user/qemu-mips | /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libglib-2.0.a(gutils.o): In function `g_get_any_init_do': | (.text+0x440): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking | /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libglib-2.0.a(gutils.o): In function `g_get_any_init_do': | (.text+0x430): warning: Using 'setpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking | /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libglib-2.0.a(gutils.o): In function `g_get_any_init_do': | (.text+0x448): warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking | /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libglib-2.0.a(gutils.o): In function `g_get_any_init_do': | (.text+0x188): warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking | /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libglib-2.0.a(gutils.o): In function `g_get_any_init_do': | (.text+0x1c8): warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking | /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libc.a(elf-init.o): In function `__libc_csu_irel': | (.text+0x144): undefined reference to `__rela_iplt_start' | /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libc.a(elf-init.o): In function `__libc_csu_irel': | (.text+0x148): undefined reference to `__rela_iplt_end' | /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libc.a(elf-init.o): In function `__libc_csu_irel': | (.text+0x14c): undefined reference to `__rela_iplt_start' | /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libc.a(elf-init.o): In function `__libc_csu_irel': | (.text+0x150): undefined reference to `__rela_iplt_end' | collect2: ld returned 1 exit status | make[1]: *** [qemu-mips] Error 1 | make: *** [subdir-mips-linux-user] Error 2
So I think it is still needed, unless you have another fix in mind.
Quoted 61 lines
Quoted 59 lines
Quoted 58 lines
It still applies cleanly to the current git, with the exception of s|^|ldscripts/| - sparc.ld moved from the top directory to ldscripts/.
(Ref: http://patchwork.ozlabs.org/patch/135267 )
Thanks,
/mjt
Quoted 43 lines · Aurelien Jarno
sparc-linux-user: Fix missing symbols in .rel/.rela.plt sections
Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols
__rel_iplt_startand__rel_iplt_endaround .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (usingSTT_GNU_IFUNC).Cc Blue Swirl <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>---
sparc.ld | 16 ++++++++++++++--1 files changed, 14 insertions(+), 2 deletions(-)sparc.ld +14
-2@@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE (__rela_iplt_start = .); + *(.rela.iplt) + PROVIDE (__rela_iplt_end = .); + } .init : { *(.init) } =0x47ff041f .text : {
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 12 lines · Aurelien Jarno
Quoted 8 lines · Blue Swirl
Quoted 5 lines · Michael Tokarev
Ping #2?
Quoted 2 lines · Michael Tokarev
This patch was submitted more than a year ago (at Jan-2012). Is it still needed? If yes, why it hasn't been applied?
Well, is it still needed?
Without it, trying to build static qemu-user on sparc leads to the following error:
...
Quoted 11 lines
| /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libc.a(elf-init.o): In function `__libc_csu_irel': | (.text+0x148): undefined reference to `__rela_iplt_end' | /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libc.a(elf-init.o): In function `__libc_csu_irel': | (.text+0x14c): undefined reference to `__rela_iplt_start' | /usr/lib/gcc/sparc-linux-gnu/4.6/../../../sparc-linux-gnu/libc.a(elf-init.o): In function `__libc_csu_irel': | (.text+0x150): undefined reference to `__rela_iplt_end' | collect2: ld returned 1 exit status | make[1]: *** [qemu-mips] Error 1 | make: *** [subdir-mips-linux-user] Error 2So I think it is still needed, unless you have another fix in mind.
If we apply this for 1.5, it will be the first release of debian package without extra fixes. Hopefully anyway :)
(Ofcourse we may add more fixes later but... ;)
/mjt