LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 28414 - lld can't be used with GCC 7
Summary: lld can't be used with GCC 7
Status: RESOLVED FIXED
Alias: None
Product: lld
Classification: Unclassified
Component: ELF (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks: 23214
  Show dependency tree
 
Reported: 2016-07-04 12:00 PDT by H.J. Lu
Modified: 2017-07-19 09:49 PDT (History)
7 users (show)

See Also:
Fixed By Commit(s):


Attachments
A testcase (1.12 KB, application/octet-stream)
2016-07-05 08:27 PDT, H.J. Lu
Details
Another testcase (872 bytes, application/octet-stream)
2016-07-05 08:33 PDT, H.J. Lu
Details
A testcase (8.66 KB, application/octet-stream)
2016-07-12 11:51 PDT, H.J. Lu
Details
Further reduced (as lit test case) (682 bytes, patch)
2017-02-26 02:21 PST, Sean Silva
Details
A testcase (532 bytes, application/octet-stream)
2017-06-30 08:26 PDT, H.J. Lu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2016-07-04 12:00:14 PDT
On Linux/x86-64, when GCC 7 configured with

/export/gnu/import/git/sources/gcc/configure --enable-languages=c,c++,fortran --disable-bootstrap --enable-libmpx --with-ld=/export/build/gnu/llvm-clang/release/opt/llvm/master/bin/lld --with-plugin-ld=/export/build/gnu/llvm-clang/release/opt/llvm/master/bin/lld  --prefix=/usr/gcc-7.0.0 --with-local-prefix=/usr/local --enable-gnu-indirect-function --with-fpmath=sse

I got

mkdir -p -- 32
/export/build/gnu/gcc-test/build-x86_64-linux/./gcc/xgcc -B/export/build/gnu/gcc-test/build-x86_64-linux/./gcc/ -B/usr/gcc-7.0.0/x86_64-pc-linux-gnu/bin/ -B/usr/gcc-7.0.0/x86_64-pc-linux-gnu/lib/ -isystem /usr/gcc-7.0.0/x86_64-pc-linux-gnu/include -isystem /usr/gcc-7.0.0/x86_64-pc-linux-gnu/sys-include    -O2  -O2 -g -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -mlong-double-80 -DUSE_ELF_SYMVER -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o 32/libgcc_s.so.1.tmp -O2 -g -m32 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o cpuinfo_s.o tf-signs_s.o sfp-exceptions_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f 32/libgcc_s.so && if [ -f 32/libgcc_s.so.1 ]; then mv -f 32/libgcc_s.so.1 32/libgcc_s.so.1.backup; else true; fi && mv 32/libgcc_s.so.1.tmp 32/libgcc_s.so.1 && (echo "/* GNU ld script"; echo "   Use the shared library, but some functions are only in"; echo "   the static library.  */"; echo "GROUP ( libgcc_s.so.1 -lgcc )" ) > 32/libgcc_s.so
-flavor option is missing. Available flavors are gnu, darwin or link.
collect2: error: ld returned 1 exit status
Makefile:945: recipe for target 'libgcc_s.so' failed
make[5]: *** [libgcc_s.so] Error 1
make[5]: Leaving directory '/export/build/gnu/gcc-test/build-x86_64-linux/x86_64-pc-linux-gnu/32/libgcc'
Comment 1 Davide Italiano 2016-07-04 12:06:47 PDT
You might want to try ld.lld instead. ld is the universal driver so you need to specify `-flavor`.
Comment 2 H.J. Lu 2016-07-04 12:15:04 PDT
A little bit better.  Now I got

/export/build/gnu/gcc-test/build-x86_64-linux/./gcc/xgcc -B/export/build/gnu/gcc-test/build-x86_64-linux/./gcc/ -B/usr/gcc-7.0.0/x86_64-pc-linux-gnu/bin/ -B/usr/gcc-7.0.0/x86_64-pc-linux-gnu/lib/ -isystem /usr/gcc-7.0.0/x86_64-pc-linux-gnu/include -isystem /usr/gcc-7.0.0/x86_64-pc-linux-gnu/sys-include    -O2  -O2 -g -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -mlong-double-80 -DUSE_ELF_SYMVER -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o 32/libgcc_s.so.1.tmp -O2 -g -m32 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o cpuinfo_s.o tf-signs_s.o sfp-exceptions_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f 32/libgcc_s.so && if [ -f 32/libgcc_s.so.1 ]; then mv -f 32/libgcc_s.so.1 32/libgcc_s.so.1.backup; else true; fi && mv 32/libgcc_s.so.1.tmp 32/libgcc_s.so.1 && (echo "/* GNU ld script"; echo "   Use the shared library, but some functions are only in"; echo "   the static library.  */"; echo "GROUP ( libgcc_s.so.1 -lgcc )" ) > 32/libgcc_s.so
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
collect2: error: ld returned 1 exit status
Makefile:945: recipe for target 'libgcc_s.so' failed
make[5]: *** [libgcc_s.so] Error 1
make[5]: Leaving directory '/export/build/gnu/gcc-test/build-x86_64-linux/x86_64-pc-linux-gnu/32/libgcc'
Makefile:1161: recipe for target 'multi-do' failed
make[4]: *** [multi-do] Error 1
make[4]: Leaving directory '/export/build/gnu/gcc-test/build-x86_64-linux/x86_64-pc-linux-gnu/libgcc'
Makefile:118: recipe for target 'all-multi' failed
make[3]: *** [all-multi] Error 2
make[3]: Leaving directory '/export/build/gnu/gcc-test/build-x86_64-linux/x86_64-pc-linux-gnu/libgcc'
Makefile:13648: recipe for target 'all-target-libgcc' failed
make[2]: *** [all-target-libgcc] Error 2
make[2]: Leaving directory '/export/build/gnu/gcc-test/build-x86_64-linux'
Makefile:910: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/export/build/gnu/gcc-test/build-x86_64-linux'
1497.20user 87.24system 4:02.25elapsed 654%CPU (0avgtext+0avgdata 949100maxresident)k
136inputs+5002168outputs (5major+28630193minor)pagefaults 0swaps
Makefile:299: recipe for target 'all' failed
make: *** [all] Error 2
Comment 3 Davide Italiano 2016-07-04 12:20:14 PDT
This seems to be a bug :)
Comment 4 Rafael Ávila de Espíndola 2016-07-04 13:13:53 PDT
(In reply to comment #2)
> A little bit better.  Now I got
> 
> /export/build/gnu/gcc-test/build-x86_64-linux/./gcc/xgcc
> -B/export/build/gnu/gcc-test/build-x86_64-linux/./gcc/
> -B/usr/gcc-7.0.0/x86_64-pc-linux-gnu/bin/
> -B/usr/gcc-7.0.0/x86_64-pc-linux-gnu/lib/ -isystem
> /usr/gcc-7.0.0/x86_64-pc-linux-gnu/include -isystem
> /usr/gcc-7.0.0/x86_64-pc-linux-gnu/sys-include    -O2  -O2 -g -DIN_GCC    -W
> -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes
> -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic
> -mlong-double-80 -DUSE_ELF_SYMVER -g -DIN_LIBGCC2 -fbuilding-libgcc
> -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1
> -Wl,--version-script=libgcc.map -o 32/libgcc_s.so.1.tmp -O2 -g -m32 -B./
> _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o
> _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o
> _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o
> _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o
> _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o
> _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o
> _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o
> _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o
> _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o
> _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o
> _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o
> _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o
> _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o
> _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o cpuinfo_s.o tf-signs_s.o
> sfp-exceptions_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o
> multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o
> floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o
> floatunditf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o
> trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o
> unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o
> emutls_s.o libgcc.a -lc && rm -f 32/libgcc_s.so && if [ -f 32/libgcc_s.so.1
> ]; then mv -f 32/libgcc_s.so.1 32/libgcc_s.so.1.backup; else true; fi && mv
> 32/libgcc_s.so.1.tmp 32/libgcc_s.so.1 && (echo "/* GNU ld script"; echo "  
> Use the shared library, but some functions are only in"; echo "   the static
> library.  */"; echo "GROUP ( libgcc_s.so.1 -lgcc )" ) > 32/libgcc_s.so
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> can't create dynamic relocation R_386_GOT32X against readonly segment
> collect2: error: ld returned 1 exit status
> Makefile:945: recipe for target 'libgcc_s.so' failed
> make[5]: *** [libgcc_s.so] Error 1
> make[5]: Leaving directory
> '/export/build/gnu/gcc-test/build-x86_64-linux/x86_64-pc-linux-gnu/32/libgcc'
> Makefile:1161: recipe for target 'multi-do' failed
> make[4]: *** [multi-do] Error 1
> make[4]: Leaving directory
> '/export/build/gnu/gcc-test/build-x86_64-linux/x86_64-pc-linux-gnu/libgcc'
> Makefile:118: recipe for target 'all-multi' failed
> make[3]: *** [all-multi] Error 2
> make[3]: Leaving directory
> '/export/build/gnu/gcc-test/build-x86_64-linux/x86_64-pc-linux-gnu/libgcc'
> Makefile:13648: recipe for target 'all-target-libgcc' failed
> make[2]: *** [all-target-libgcc] Error 2
> make[2]: Leaving directory '/export/build/gnu/gcc-test/build-x86_64-linux'
> Makefile:910: recipe for target 'all' failed
> make[1]: *** [all] Error 2
> make[1]: Leaving directory '/export/build/gnu/gcc-test/build-x86_64-linux'
> 1497.20user 87.24system 4:02.25elapsed 654%CPU (0avgtext+0avgdata
> 949100maxresident)k
> 136inputs+5002168outputs (5major+28630193minor)pagefaults 0swaps
> Makefile:299: recipe for target 'all' failed
> make: *** [all] Error 2


Would you mind passing "--reproduce foo" and attaching foo.cpio to this bug?
Comment 5 H.J. Lu 2016-07-04 13:36:00 PDT
(In reply to comment #4)
> 
> Would you mind passing "--reproduce foo" and attaching foo.cpio to this bug?

File size is 5MB which is too big to upload.
Comment 6 Davide Italiano 2016-07-04 14:44:33 PDT
We generally recommend to upload on any ftp/fileserver or using something like google drive/dropbox if the attachment exceeds bugzilla limit. Can you please do that if it's not too much hassle?
Comment 7 Rafael Ávila de Espíndola 2016-07-04 16:11:51 PDT
(In reply to comment #5)
> (In reply to comment #4)
> > 
> > Would you mind passing "--reproduce foo" and attaching foo.cpio to this bug?
> 
> File size is 5MB which is too big to upload.

xz or bzip2 might put it under the limit. If you don't have a public place to put it, could you just email me the file?
Comment 8 H.J. Lu 2016-07-05 08:27:54 PDT
Created attachment 16690 [details]
A testcase

[hjl@gnu-tools-1 pr28414]$ make
./ld -m elf_i386 -shared -o x.so x.o
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
Makefile:29: recipe for target 'x.so' failed
make: *** [x.so] Error 1
[hjl@gnu-tools-1 pr28414]$
Comment 9 H.J. Lu 2016-07-05 08:31:03 PDT
(In reply to comment #8)
> Created attachment 16690 [details]
> A testcase
> 
> [hjl@gnu-tools-1 pr28414]$ make
> ./ld -m elf_i386 -shared -o x.so x.o
> can't create dynamic relocation R_386_GOT32X against readonly segment
...
> [hjl@gnu-tools-1 pr28414]$

[hjl@gnu-tools-1 pr28414]$ make LD=ld x.so
ld -m elf_i386 -shared -o x.so x.o
ld: x.o: direct GOT relocation R_386_GOT32X against `bar' without base register can not be used when making a shared object
ld: failed to set dynamic section sizes: File format not recognized
Makefile:28: recipe for target 'x.so' failed
make: *** [x.so] Error 1
[hjl@gnu-tools-1 pr28414]$
Comment 10 H.J. Lu 2016-07-05 08:33:36 PDT
Created attachment 16691 [details]
Another testcase

[hjl@gnu-tools-1 pr28414]$ make LD=ld z.so
gcc -B./ -m32 -fno-lto    -c -o z.o z.S
ld -m elf_i386 -shared -o z.so z.o
[hjl@gnu-tools-1 pr28414]$ objdump -dw z.so

z.so:     file format elf32-i386


Disassembly of section .text:

00000170 <_start>:
 170:	8d 81 0c 00 00 00    	lea    0xc(%ecx),%eax
 176:	13 81 f8 ff ff ff    	adc    -0x8(%ecx),%eax
 17c:	03 99 f8 ff ff ff    	add    -0x8(%ecx),%ebx
 182:	23 89 f8 ff ff ff    	and    -0x8(%ecx),%ecx
 188:	3b 91 f8 ff ff ff    	cmp    -0x8(%ecx),%edx
 18e:	0b b9 f8 ff ff ff    	or     -0x8(%ecx),%edi
 194:	1b b1 f8 ff ff ff    	sbb    -0x8(%ecx),%esi
 19a:	2b a9 f8 ff ff ff    	sub    -0x8(%ecx),%ebp
 1a0:	33 a1 f8 ff ff ff    	xor    -0x8(%ecx),%esp
 1a6:	85 89 f8 ff ff ff    	test   %ecx,-0x8(%ecx)
 1ac:	8b 81 fc ff ff ff    	mov    -0x4(%ecx),%eax
 1b2:	13 81 fc ff ff ff    	adc    -0x4(%ecx),%eax
 1b8:	03 99 fc ff ff ff    	add    -0x4(%ecx),%ebx
 1be:	23 89 fc ff ff ff    	and    -0x4(%ecx),%ecx
 1c4:	3b 91 fc ff ff ff    	cmp    -0x4(%ecx),%edx
 1ca:	0b b9 fc ff ff ff    	or     -0x4(%ecx),%edi
 1d0:	1b b1 fc ff ff ff    	sbb    -0x4(%ecx),%esi
 1d6:	2b a9 fc ff ff ff    	sub    -0x4(%ecx),%ebp
 1dc:	33 a1 fc ff ff ff    	xor    -0x4(%ecx),%esp
 1e2:	85 89 fc ff ff ff    	test   %ecx,-0x4(%ecx)
[hjl@gnu-tools-1 pr28414]$ rm -f z.so
[hjl@gnu-tools-1 pr28414]$ make z.so
./ld -m elf_i386 -shared -o z.so z.o
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
can't create dynamic relocation R_386_GOT32X against readonly segment
Makefile:31: recipe for target 'z.so' failed
make: *** [z.so] Error 1
[hjl@gnu-tools-1 pr28414]$
Comment 11 Rafael Ávila de Espíndola 2016-07-06 16:53:13 PDT
At least the reduced test case passes with r274690.

Can you give gcc another try?
Comment 12 H.J. Lu 2016-07-11 12:18:24 PDT
r275003 gave me:

/export/build/gnu/gcc-lld/build-x86_64-linux/./gcc/xgcc -B/export/build/gnu/gcc-lld/build-x86_64-linux/./gcc/ -B/usr/gcc-7.0.0/x86_64-pc-linux-gnu/bin/ -B/usr/gcc-7.0.0/x86_64-pc-linux-gnu/lib/ -isystem /usr/gcc-7.0.0/x86_64-pc-linux-gnu/include -isystem /usr/gcc-7.0.0/x86_64-pc-linux-gnu/sys-include    -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -mlong-double-80 -DUSE_ELF_SYMVER -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o cpuinfo_s.o sfp-exceptions_s.o addtf3_s.o divtf3_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o getf2_s.o letf2_s.o eqtf2_s.o _divtc3_s.o _multc3_s.o _powitf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && (echo "/* GNU ld script"; echo "   Use the shared library, but some functions are only in"; echo "   the static library.  */"; echo "GROUP ( libgcc_s.so.1 -lgcc )" ) > ./libgcc_s.so
duplicate symbol: __letf2 in letf2_s.o and libgcc.a(letf2.o)
duplicate symbol: __eqtf2 in eqtf2_s.o and libgcc.a(eqtf2.o)
Comment 13 Rafael Ávila de Espíndola 2016-07-11 13:04:01 PDT
> enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o
> unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so
> && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1
> ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp
> ./libgcc_s.so.1 && (echo "/* GNU ld script"; echo "   Use the shared
> library, but some functions are only in"; echo "   the static library.  */";
> echo "GROUP ( libgcc_s.so.1 -lgcc )" ) > ./libgcc_s.so
> duplicate symbol: __letf2 in letf2_s.o and libgcc.a(letf2.o)
> duplicate symbol: __eqtf2 in eqtf2_s.o and libgcc.a(eqtf2.o)


Interesting. I fist thought it would be the archive member lookup logic, but the only reference to libgcc is clearly after the .o files.

Can you put the cpio created by "--reproduce foo" somewhere?
Comment 14 H.J. Lu 2016-07-12 11:51:08 PDT
Created attachment 16732 [details]
A testcase

[hjl@gnu-18 pr28414]$ make
./ld  -shared -o x.so x.o y.o libfoo.a --version-script=libfoo.map
duplicate symbol: x in x.o and libfoo.a(foo.o)
Makefile:9: recipe for target 'x.so' failed
make: *** [x.so] Error 1
Comment 15 Sean Silva 2017-02-26 02:21:36 PST
Created attachment 18028 [details]
Further reduced (as lit test case)

Further reduced.

repro.tar is here: https://reviews.llvm.org/F3117406
(though the .s files in the attached patch are probably good enough to look at)

It seems that LLD does not recognize that %t.o defines `foo`.

test/ELF/Inputs/pr28414.s

.global foo
  jmp foo

test/ELF/pr28414.s

// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/pr28414.s -o %t2.o
// RUN: echo "SOME_VERSION { global: *; };" > %t.map
// RUN: ld.lld %t.o %t2.o --version-script %t.map -o %t

.global _start
_start:
.symver _start, foo@@SOME_VERSION
Comment 16 Sean Silva 2017-02-27 22:44:36 PST
Further reduced:

test/ELF/pr28414.s

// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
// RUN: echo "SOME_VERSION { global: *; };" > %t.map
// RUN: ld.lld %t.o --version-script %t.map -o %t

.global _start
.global bar
.symver _start, bar@@SOME_VERSION
_start:
  jmp bar
Comment 17 George Rimar 2017-05-30 08:43:13 PDT
Patch: https://reviews.llvm.org/D33680
Comment 18 George Rimar 2017-06-30 03:22:41 PDT
(In reply to Sean Silva from comment #16)
> Further reduced:
> 
> test/ELF/pr28414.s
> 
> // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
> // RUN: echo "SOME_VERSION { global: *; };" > %t.map
> // RUN: ld.lld %t.o --version-script %t.map -o %t
> 
> .global _start
> .global bar
> .symver _start, bar@@SOME_VERSION
> _start:
>   jmp bar

This case was fixed in r306813, not sure if it is enough to close whole PR.
Comment 19 H.J. Lu 2017-06-30 08:25:03 PDT
(In reply to George Rimar from comment #18)
> (In reply to Sean Silva from comment #16)
> > Further reduced:
> > 
> > test/ELF/pr28414.s
> > 
> > // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
> > // RUN: echo "SOME_VERSION { global: *; };" > %t.map
> > // RUN: ld.lld %t.o --version-script %t.map -o %t
> > 
> > .global _start
> > .global bar
> > .symver _start, bar@@SOME_VERSION
> > _start:
> >   jmp bar
> 
> This case was fixed in r306813, not sure if it is enough to close whole PR.

lld r306813 still fails.
Comment 20 H.J. Lu 2017-06-30 08:26:01 PDT
Created attachment 18735 [details]
A testcase

[hjl@gnu-skl-1 pr28414]$ make
cc -fpic -g   -c -o x.o x.c
cc -fpic -g   -c -o y.o y.c
cc -fpic -g   -c -o foo.o foo.c
ar rv libfoo.a foo.o
ar: creating libfoo.a
a - foo.o
./ld  -shared -o x.so x.o y.o libfoo.a --version-script=libfoo.map
./ld: error: duplicate symbol: x
>>> defined at x.c:3
>>>            x.o:(x)
>>> defined at foo.c:3
>>>            foo.o:(.text+0x0) in archive libfoo.a
Makefile:9: recipe for target 'x.so' failed
make: *** [x.so] Error 1
rm foo.o
[hjl@gnu-skl-1 pr28414]$
Comment 21 George Rimar 2017-07-06 08:05:33 PDT
(In reply to H.J. Lu from comment #20)
> Created attachment 18735 [details]
> A testcase
> 
> [hjl@gnu-skl-1 pr28414]$ make
> cc -fpic -g   -c -o x.o x.c
> cc -fpic -g   -c -o y.o y.c
> cc -fpic -g   -c -o foo.o foo.c
> ar rv libfoo.a foo.o
> ar: creating libfoo.a
> a - foo.o
> ./ld  -shared -o x.so x.o y.o libfoo.a --version-script=libfoo.map
> ./ld: error: duplicate symbol: x
> >>> defined at x.c:3
> >>>            x.o:(x)
> >>> defined at foo.c:3
> >>>            foo.o:(.text+0x0) in archive libfoo.a
> Makefile:9: recipe for target 'x.so' failed
> make: *** [x.so] Error 1
> rm foo.o
> [hjl@gnu-skl-1 pr28414]$

Thanks for sample ! Possible patch posted here: https://reviews.llvm.org/D35059
Comment 22 George Rimar 2017-07-07 01:37:18 PDT
(In reply to George Rimar from comment #21)
> (In reply to H.J. Lu from comment #20)
> > Created attachment 18735 [details]
> > A testcase
> > 
> > [hjl@gnu-skl-1 pr28414]$ make
> > cc -fpic -g   -c -o x.o x.c
> > cc -fpic -g   -c -o y.o y.c
> > cc -fpic -g   -c -o foo.o foo.c
> > ar rv libfoo.a foo.o
> > ar: creating libfoo.a
> > a - foo.o
> > ./ld  -shared -o x.so x.o y.o libfoo.a --version-script=libfoo.map
> > ./ld: error: duplicate symbol: x
> > >>> defined at x.c:3
> > >>>            x.o:(x)
> > >>> defined at foo.c:3
> > >>>            foo.o:(.text+0x0) in archive libfoo.a
> > Makefile:9: recipe for target 'x.so' failed
> > make: *** [x.so] Error 1
> > rm foo.o
> > [hjl@gnu-skl-1 pr28414]$
> 
> Thanks for sample ! Possible patch posted here:
> https://reviews.llvm.org/D35059

Committed, r307364.
Comment 23 Rafael Ávila de Espíndola 2017-07-07 07:44:41 PDT
(In reply to George Rimar from comment #22)
> (In reply to George Rimar from comment #21)
> > (In reply to H.J. Lu from comment #20)
> > > Created attachment 18735 [details]
> > > A testcase
> > > 
> > > [hjl@gnu-skl-1 pr28414]$ make
> > > cc -fpic -g   -c -o x.o x.c
> > > cc -fpic -g   -c -o y.o y.c
> > > cc -fpic -g   -c -o foo.o foo.c
> > > ar rv libfoo.a foo.o
> > > ar: creating libfoo.a
> > > a - foo.o
> > > ./ld  -shared -o x.so x.o y.o libfoo.a --version-script=libfoo.map
> > > ./ld: error: duplicate symbol: x
> > > >>> defined at x.c:3
> > > >>>            x.o:(x)
> > > >>> defined at foo.c:3
> > > >>>            foo.o:(.text+0x0) in archive libfoo.a
> > > Makefile:9: recipe for target 'x.so' failed
> > > make: *** [x.so] Error 1
> > > rm foo.o
> > > [hjl@gnu-skl-1 pr28414]$
> > 
> > Thanks for sample ! Possible patch posted here:
> > https://reviews.llvm.org/D35059
> 
> Committed, r307364.

Is this fixed then?
Comment 24 George Rimar 2017-07-07 08:05:07 PDT
(In reply to Rafael Ávila de Espíndola from comment #23)
> (In reply to George Rimar from comment #22)
> > (In reply to George Rimar from comment #21)
> > > (In reply to H.J. Lu from comment #20)
> > > > Created attachment 18735 [details]
> > > > A testcase
> > > > 
> > > > [hjl@gnu-skl-1 pr28414]$ make
> > > > cc -fpic -g   -c -o x.o x.c
> > > > cc -fpic -g   -c -o y.o y.c
> > > > cc -fpic -g   -c -o foo.o foo.c
> > > > ar rv libfoo.a foo.o
> > > > ar: creating libfoo.a
> > > > a - foo.o
> > > > ./ld  -shared -o x.so x.o y.o libfoo.a --version-script=libfoo.map
> > > > ./ld: error: duplicate symbol: x
> > > > >>> defined at x.c:3
> > > > >>>            x.o:(x)
> > > > >>> defined at foo.c:3
> > > > >>>            foo.o:(.text+0x0) in archive libfoo.a
> > > > Makefile:9: recipe for target 'x.so' failed
> > > > make: *** [x.so] Error 1
> > > > rm foo.o
> > > > [hjl@gnu-skl-1 pr28414]$
> > > 
> > > Thanks for sample ! Possible patch posted here:
> > > https://reviews.llvm.org/D35059
> > 
> > Committed, r307364.
> 
> Is this fixed then?

Initial issue is about 1 year old, honestly I am a bit lost what we are fixing here.
There were errors about "can not create dynamic relocation", "direct GOT relocation R_386_GOT32X against `bar' without base register can not be used when making a shared object" and recent errors about symbol versioning which were fixed.
May be worth to close this one and create separate PRs for each single issue if any exist still.
Comment 25 H.J. Lu 2017-07-07 08:15:29 PDT
(In reply to Rafael Ávila de Espíndola from comment #23)
> 
> Is this fixed then?

Version info is wrong:

[hjl@gnu-skl-1 pr28414b]$ cat x.c
void
__netf2_shared (void)
{
}

asm (".globl __netf2_compat");
asm ("__netf2_compat = __netf2_shared");

asm (".symver __netf2_compat,__netf2@GCC_3.0");
asm (".symver __netf2_shared,__netf2@@GCC_4.3.0");
[hjl@gnu-skl-1 pr28414b]$ cat y.c
extern void __netf2 (void);

void
y (void)
{
  __netf2 ();
}
[hjl@gnu-skl-1 pr28414b]$ cat libfoo.map 
GCC_3.0
{
global:
  __netf2;
local:
   *;
};
GCC_4.3.0
{
global:
  __netf2;
} GCC_3.0;
[hjl@gnu-skl-1 pr28414b]$ make
cc -fpic -g   -c -o y.o y.c
cc -fpic -g   -c -o x.o x.c
cc -fpic -g   -c -o foo.o foo.c
ar rv libfoo.a foo.o
ar: creating libfoo.a
a - foo.o
./ld  --version-script=libfoo.map -shared -o x.so y.o x.o libfoo.a
./ld: warning: duplicate symbol '__netf2' in version script
readelf -V x.so

Version symbols section '.gnu.version' contains 3 entries:
 Addr: 0000000000000210  Offset: 0x000210  Link: 1 (.dynsym)
  000:   0 (*local*)       3 (GCC_4.3.0)     2h(GCC_3.0)    

Version definition section '.gnu.version_d' contains 3 entries:
  Addr: 0x0000000000000218  Offset: 0x000218  Link: 5 (.dynstr)
  000000: Rev: 1  Flags: BASE  Index: 1  Cnt: 1  Name: x.so
  0x001c: Rev: 1  Flags: none  Index: 2  Cnt: 1  Name: GCC_3.0
  0x0038: Rev: 1  Flags: none  Index: 3  Cnt: 1  Name: GCC_4.3.0
rm foo.o
[hjl@gnu-skl-1 pr28414b]$ 

[hjl@gnu-skl-1 pr28414b]$ make LD=ld
cc -fpic -g   -c -o y.o y.c
cc -fpic -g   -c -o x.o x.c
cc -fpic -g   -c -o foo.o foo.c
ar rv libfoo.a foo.o
ar: creating libfoo.a
a - foo.o
ld  --version-script=libfoo.map -shared -o x.so y.o x.o libfoo.a
readelf -V x.so

Version symbols section '.gnu.version' contains 5 entries:
 Addr: 0000000000000218  Offset: 0x000218  Link: 2 (.dynsym)
  000:   0 (*local*)       2 (GCC_3.0)       3 (GCC_4.3.0)     3 (GCC_4.3.0)  
  004:   2h(GCC_3.0)    

Version definition section '.gnu.version_d' contains 3 entries:
  Addr: 0x0000000000000228  Offset: 0x000228  Link: 3 (.dynstr)
  000000: Rev: 1  Flags: BASE  Index: 1  Cnt: 1  Name: x.so
  0x001c: Rev: 1  Flags: none  Index: 2  Cnt: 1  Name: GCC_3.0
  0x0038: Rev: 1  Flags: none  Index: 3  Cnt: 2  Name: GCC_4.3.0
  0x0054: Parent 1: GCC_3.0  <<<<<<<<<< This is missing from lld.
rm foo.o
[hjl@gnu-skl-1 pr28414b]$
Comment 26 George Rimar 2017-07-07 08:34:09 PDT
(In reply to H.J. Lu from comment #25)
> (In reply to Rafael Ávila de Espíndola from comment #23)
> > 
> > Is this fixed then?
> 
> Version info is wrong:
> 
>   0x0054: Parent 1: GCC_3.0  <<<<<<<<<< This is missing from lld.

So this is issue you are talking about and nothing else wrong here, right ? If so - that is probably not an issue, because we removed support of
version hierarchies intentionally. We implemented it at first in r273423 and then removed in r274345 (https://reviews.llvm.org/D21888), as them are not important.
Comment 27 H.J. Lu 2017-07-07 09:12:30 PDT
(In reply to George Rimar from comment #26)
> (In reply to H.J. Lu from comment #25)
> > (In reply to Rafael Ávila de Espíndola from comment #23)
> > > 
> > > Is this fixed then?
> > 
> > Version info is wrong:
> > 
> >   0x0054: Parent 1: GCC_3.0  <<<<<<<<<< This is missing from lld.
> 
> So this is issue you are talking about and nothing else wrong here, right ?
> If so - that is probably not an issue, because we removed support of
> version hierarchies intentionally. We implemented it at first in r273423 and
> then removed in r274345 (https://reviews.llvm.org/D21888), as them are not
> important.

Is lld designed to be compatible with ld in term of symbol versioning?
If not, this bug can be closed and lld can't be a replacement of ld.
If yes, this bug should remain open.
Comment 28 Rafael Ávila de Espíndola 2017-07-10 10:42:18 PDT
> > > Version info is wrong:
> > > 
> > >   0x0054: Parent 1: GCC_3.0  <<<<<<<<<< This is missing from lld.
> > 
> > So this is issue you are talking about and nothing else wrong here, right ?
> > If so - that is probably not an issue, because we removed support of
> > version hierarchies intentionally. We implemented it at first in r273423 and
> > then removed in r274345 (https://reviews.llvm.org/D21888), as them are not
> > important.
> 
> Is lld designed to be compatible with ld in term of symbol versioning?
> If not, this bug can be closed and lld can't be a replacement of ld.
> If yes, this bug should remain open.

It should be mostly compatible, so we need a bit more information to decide.

According to https://www.akkadia.org/drepper/dsohowto.pdf

"The fourth point, the VERS 1.0 version being referred to in the VERS 2.0 definition, is not really important in symbol versioning. It marks the predecessor relationship of the two versions and it is done to maintain the similar- ities with Solaris’ internal versioning. It does not cause any problem it might in fact be useful to a human reader so predecessors should always be mentioned."

If that is still the case, then we will probably keep the difference from BFD. If something changed (or that paragraph was wrong to begin with), then we can change lld.
Comment 29 H.J. Lu 2017-07-10 11:05:55 PDT
O tried removing parent version info in glibc by hand and it doesn't seem to
change run-time behavior for glibc tests. However,

Version definitions:
1 0x01 0x0865f4e6 libc.so.6
2 0x00 0x09691a75 GLIBC_2.2.5
3 0x00 0x09691a76 GLIBC_2.2.6
	GLIBC_2.2.5 
4 0x00 0x0d696913 GLIBC_2.3
	GLIBC_2.2.6 
5 0x00 0x09691972 GLIBC_2.3.2
	GLIBC_2.3 
6 0x00 0x09691973 GLIBC_2.3.3
	GLIBC_2.3.2 
7 0x00 0x09691974 GLIBC_2.3.4
	GLIBC_2.3.3 
8 0x00 0x0d696914 GLIBC_2.4
	GLIBC_2.3.4 
9 0x00 0x0d696915 GLIBC_2.5
	GLIBC_2.4 
10 0x00 0x0d696916 GLIBC_2.6
	GLIBC_2.5 
11 0x00 0x0d696917 GLIBC_2.7
	GLIBC_2.6 
12 0x00 0x0d696918 GLIBC_2.8
	GLIBC_2.7 
13 0x00 0x0d696919 GLIBC_2.9
	GLIBC_2.8 
14 0x00 0x06969190 GLIBC_2.10
	GLIBC_2.9 
15 0x00 0x06969191 GLIBC_2.11
	GLIBC_2.10 
16 0x00 0x06969192 GLIBC_2.12
	GLIBC_2.11 
17 0x00 0x06969193 GLIBC_2.13
	GLIBC_2.12 
18 0x00 0x06969194 GLIBC_2.14
	GLIBC_2.13 
19 0x00 0x06969195 GLIBC_2.15
	GLIBC_2.14 
20 0x00 0x06969196 GLIBC_2.16
	GLIBC_2.15 
21 0x00 0x06969197 GLIBC_2.17
	GLIBC_2.16 
22 0x00 0x06969198 GLIBC_2.18
	GLIBC_2.17 
23 0x00 0x06969182 GLIBC_2.22
	GLIBC_2.18 
24 0x00 0x06969183 GLIBC_2.23
	GLIBC_2.22 
25 0x00 0x06969184 GLIBC_2.24
	GLIBC_2.23 
26 0x00 0x0963cf85 GLIBC_PRIVATE
	GLIBC_2.24 

includes useful info for ABI versions.  It shows that no versions are skipped.
Comment 30 H.J. Lu 2017-07-10 11:07:29 PDT
BTW, I am OK to close this bug.  But it is probably means that there will be
no -fuse-ld=lld support in GCC.
Comment 31 emaste 2017-07-16 13:03:30 PDT
r307364 claims it fixes the last testcase from this PR, but that change breaks linking FreeBSD/arm64.

See details in https://reviews.llvm.org/rL307364
Comment 32 Rafael Ávila de Espíndola 2017-07-19 09:49:42 PDT
As of r308492 every issue listed here other than version references has been fixed.

Since dropping support for version references was an explicit decision, I am closing this for now.