Project

General

Profile

Bug #6094

SPARC: gcc48 build: ld: warning: relocation warning: R_SPARC_WPLT30

Added by Igor Kozhukhov over 4 years ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
2015-08-01
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

/export/home/build/local/dilos-illumos.git/usr/src/tools/proto/root_sparc-nd/opt/onbld/bin/sparc/cw -_gcc -xO3 -m64 -dalign -v  -Wc,-Qiselect-regsym=0  -Wc,-Qassembler-ounrefsym=0 -xspace -W0,-Lt -Xa  -xildoff -errtags=yes -errwarn=%all -erroff=E_EMPTY_TRANSLATION_UNIT -erroff=E_STATEMENT_NOT_REACHED -_gcc=-Wno-missing-braces -_gcc=-Wno-sign-compare -_gcc=-Wno-unknown-pragmas -_gcc=-Wno-unused-parameter -_gcc=-Wno-missing-field-initializers -_gcc=-Wno-array-bounds -xc99=%none -Wd,-xsafe=unboundsym -W2,-xwrap_int  -W0,-xglobalstatic -_gcc=-fno-inline-small-functions  -_gcc=-fno-inline-functions-called-once  -_gcc=-fno-ipa-cp    -v -o libmd.so.1 -G -hlibmd.so.1 -ztext -zdefs -Bdirect  -M../common/mapfile-vers -M/export/home/build/local/dilos-illumos.git/usr/src/common/mapfiles/common/map.pagealign   pics/md4.o pics/md5.o pics/sha1.o pics/sha2.o ../capabilities/sun4u/sparcv9/pics/symcap.o  ../capabilities/sun4v/sparcv9/pics/symcap.o  -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9 -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9 -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/usr/lib/sparcv9      -Wl,-z,relaxreloc -lc
+ /usr/gcc/4.8/bin/gcc -fident -finline -fno-inline-functions -fno-builtin -fno-asm -fdiagnostics-show-option -nodefaultlibs -mno-integer-ldd-std -D__sun -fno-strict-aliasing -fno-unit-at-a-time -fno-optimize-sibling-calls -O2 -m64 -Wall -Wextra -Werror -Wno-missing-braces -Wno-sign-compare -Wno-unknown-pragmas -Wno-unused-parameter -Wno-missing-field-initializers -Wno-array-bounds -std=gnu89 -fno-inline-small-functions -fno-inline-functions-called-once -fno-ipa-cp -o libmd.so.1 -shared -hlibmd.so.1 -Wl,-ztext -Wl,-zdefs -Wl,-Bdirect -Wl,-M../common/mapfile-vers -Wl,-M/export/home/build/local/dilos-illumos.git/usr/src/common/mapfiles/common/map.pagealign pics/md4.o pics/md5.o pics/sha1.o pics/sha2.o ../capabilities/sun4u/sparcv9/pics/symcap.o ../capabilities/sun4v/sparcv9/pics/symcap.o -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9 -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9 -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/usr/lib/sparcv9 -Wl,-z,relaxreloc -lc -mcpu=v9 
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4u/sparcv9/pics/symcap.o: section [20].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].gnu.linkonce.t.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4u/sparcv9/pics/symcap.o: section [20].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].gnu.linkonce.t.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4u/sparcv9/pics/symcap.o: section [20].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].gnu.linkonce.t.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4u/sparcv9/pics/symcap.o: section [20].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].gnu.linkonce.t.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4u/sparcv9/pics/symcap.o: section [20].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].gnu.linkonce.t.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4v/sparcv9/pics/symcap.o: section [20].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].gnu.linkonce.t.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4v/sparcv9/pics/symcap.o: section [20].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].gnu.linkonce.t.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4v/sparcv9/pics/symcap.o: section [20].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].gnu.linkonce.t.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
/usr/bin/rm -f /export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9/libmd.so.1; install -s -m 755 -f /export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9 libmd.so.1      

Files

symcap.o.64.44 (49 KB) symcap.o.64.44 object file 64bit gcc44 build Igor Kozhukhov, 2015-08-01 12:29 AM
symcap.o.64.48 (63.9 KB) symcap.o.64.48 object file 64bit gcc48 build Igor Kozhukhov, 2015-08-01 12:29 AM

Related issues

Related to illumos gate - Bug #7487: ld failed on sparc with relocationClosed2016-10-21

Actions
Related to illumos gate - Bug #10346: ld(1) should not reduce symbol visibility of COMDAT symbols when producing relocatable objectsClosed2019-02-05

Actions

History

#2

Updated by Igor Kozhukhov over 4 years ago

i have tested with gcc48 + gnu as + illumos ld

/export/home/build/local/dilos-illumos.git/usr/src/tools/proto/root_sparc-nd/opt/onbld/bin/sparc/cw -_gcc -xO3 -m64 -dalign -v  -Wc,-Qiselect-regsym=0  -Wc,-Qassembler-ounrefsym=0 -xspace -W0,-Lt -Xa  -xildoff -errtags=yes -errwarn=%all -erroff=E_EMPTY_TRANSLATION_UNIT -erroff=E_STATEMENT_NOT_REACHED -_gcc=-Wno-missing-braces -_gcc=-Wno-sign-compare -_gcc=-Wno-unknown-pragmas -_gcc=-Wno-unused-parameter -_gcc=-Wno-missing-field-initializers -_gcc=-Wno-array-bounds -xc99=%none -Wd,-xsafe=unboundsym -W2,-xwrap_int  -W0,-xglobalstatic -_gcc=-fno-inline-small-functions  -_gcc=-fno-inline-functions-called-once  -_gcc=-fno-ipa-cp    -v -o libmd.so.1 -G -hlibmd.so.1 -ztext -zdefs -Bdirect  -M../common/mapfile-vers -M/export/home/build/local/dilos-illumos.git/usr/src/common/mapfiles/common/map.pagealign   pics/md4.o pics/md5.o pics/sha1.o pics/sha2.o ../capabilities/sun4u/sparcv9/pics/symcap.o  ../capabilities/sun4v/sparcv9/pics/symcap.o  -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9 -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9 -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/usr/lib/sparcv9      -lc
+ /usr/gcc/4.8-c/bin/gcc -fident -finline -fno-inline-functions -fno-builtin -fno-asm -fdiagnostics-show-option -nodefaultlibs -mno-integer-ldd-std -D__sun -fno-strict-aliasing -fno-unit-at-a-time -fno-optimize-sibling-calls -O2 -m64 -Wall -Wextra -Werror -Wno-missing-braces -Wno-sign-compare -Wno-unknown-pragmas -Wno-unused-parameter -Wno-missing-field-initializers -Wno-array-bounds -std=gnu89 -fno-inline-small-functions -fno-inline-functions-called-once -fno-ipa-cp -o libmd.so.1 -shared -hlibmd.so.1 -Wl,-ztext -Wl,-zdefs -Wl,-Bdirect -Wl,-M../common/mapfile-vers -Wl,-M/export/home/build/local/dilos-illumos.git/usr/src/common/mapfiles/common/map.pagealign pics/md4.o pics/md5.o pics/sha1.o pics/sha2.o ../capabilities/sun4u/sparcv9/pics/symcap.o ../capabilities/sun4v/sparcv9/pics/symcap.o -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9 -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9 -L/export/home/build/local/dilos-illumos.git/proto/root_sparc/usr/lib/sparcv9 -lc -mcpu=v9 
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4u/sparcv9/pics/symcap.o: section [22].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].text.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4u/sparcv9/pics/symcap.o: section [22].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].text.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4u/sparcv9/pics/symcap.o: section [22].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].text.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4u/sparcv9/pics/symcap.o: section [22].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].text.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4u/sparcv9/pics/symcap.o: section [22].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].text.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4v/sparcv9/pics/symcap.o: section [21].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].text.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4v/sparcv9/pics/symcap.o: section [21].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].text.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
ld: warning: relocation warning: R_SPARC_WPLT30: file ../capabilities/sun4v/sparcv9/pics/symcap.o: section [21].rela.text: symbol __sparc_get_pc_thunk.l7: relocation against discarded COMDAT section [4].text.__sparc_get_pc_thunk.l7: symbol not found, relocation ignored
/usr/bin/rm -f /export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9/libmd.so.1; install -s -m 755 -f /export/home/build/local/dilos-illumos.git/proto/root_sparc/lib/sparcv9 libmd.so.1      
#3

Updated by Rich Lowe over 4 years ago

  • Assignee set to Rich Lowe

What happens here is that when we produce the objcap.o object, we pass -Breduce to the link editor. This reduces __sparc_get_pc_thunk.l7 from WEAK to LOCL. Because of this, sloppy relocation processing fails on this symbol, because the symbol visibilities no longer match, and this warning is produced.

It is not clear to me how to fix this. Every step of the way, the link-editor is doing what's been asked of it, and it's not obvious how a way to ask it to do the specific things we'd want in this case (no reduction of that symbol, sloppy processing even though visibility mismatch, whatever) is implementable or sane.

#4

Updated by Rich Lowe over 4 years ago

A workaround is to explicitly eliminate the problematic symbol.

diff --git a/usr/src/lib/libmd/capabilities/sun4u/common/mapfile-cap b/usr/src/lib/libmd/capabilities/sun4u/common/mapfile-cap
index 1e7c55a..3aedc31 100644
--- a/usr/src/lib/libmd/capabilities/sun4u/common/mapfile-cap
+++ b/usr/src/lib/libmd/capabilities/sun4u/common/mapfile-cap
@@ -35,6 +35,8 @@ SYMBOL_SCOPE {
             SHA1Init;
               SHA1Update;
             SHA1Final;
+     eliminate:
+             __sparc_get_pc_thunk.l7;
        local:
          *;
 };
diff --git a/usr/src/lib/libmd/capabilities/sun4v/common/mapfile-cap b/usr/src/lib/libmd/capabilities/sun4v/common/mapfile-cap
index 72b5738..7a82f24 100644
--- a/usr/src/lib/libmd/capabilities/sun4v/common/mapfile-cap
+++ b/usr/src/lib/libmd/capabilities/sun4v/common/mapfile-cap
@@ -32,6 +32,8 @@ SYMBOL_SCOPE {
              MD5Init;
                 MD5Update;
                 MD5Final;
+  eliminate:
+             __sparc_get_pc_thunk.l7;
         local:
                 *;
 };

I must stress I haven't tested this beyond watching it build, and that this patch is incomplete, since this symbol will not exist in a studio build, and thus the link will fail in such a build.

We would need a means to condition the mapfile on whether this was a GCC build or not.

#5

Updated by Rich Lowe over 4 years ago

  • Status changed from New to Feedback

I'm hesitant to attempt to "fix" this, since I think that ultimately the problem we have is due to the need for sloppy relocation processing, because the compiler has produced references to a comdat group from a section not within that group, which it should not. We have sloppy processing as a workaround specifically for GCC's tendency to do this, but to the extent that that sloppy processing and the necessary steps in building capabilities objects can conflict, I think any attempt at a "fix" is just going to radically complicate -- and probably break -- the code.

#6

Updated by Igor Kozhukhov over 3 years ago

if we have LD build by gcc 5.4 and try to use workaround with map file, we have core dump:

igork@bld13:~/builds/igork/dg-54/usr/src/lib/libmd/capabilities/sun4u/sparcv9$ mdb core 
Loading modules: [ ld libc.so.1 ld.so.1 ]
> $C
ffffffff7fffe031 libld.so.4`update_ogroup+0x5c(ffffffff7e400020, 0, ffffffff7e401700, 0, 
ffffffff7e405d48, ffffffff7e10b470)
ffffffff7fffe0e1 libld.so.4`ld64_update_outfile+0x654(ffffffff7e400020, 0, 0, 0, d, 0)
ffffffff7fffe211 libld.so.4`ld64_main+0x4dc(8, 0, 0, 0, fffffffec663dbf0, ffffffff7e400020)
ffffffff7fffe2d1 main+0x120(8, ffffffff7fffec48, ffffffff7fffec90, 100105498, 100000000, 0)
ffffffff7fffe391 _start+0x7c(0, 0, 0, 0, 0, 0)

#7

Updated by Igor Kozhukhov over 3 years ago

  • Related to Bug #7487: ld failed on sparc with relocation added
#8

Updated by Rich Lowe about 1 year ago

  • Related to Bug #10346: ld(1) should not reduce symbol visibility of COMDAT symbols when producing relocatable objects added
#9

Updated by Rich Lowe 11 months ago

Igor, did #10346 fix this?

#10

Updated by Igor Kozhukhov 6 months ago

Rich Lowe wrote:

Igor, did #10346 fix this?

issues have been fixed, you can close it
i have tested build by gcc6 on sparc

#11

Updated by Joshua M. Clulow 6 months ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF