http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53803
Bug #: 53803 Summary: --enable-target-optspace gives undefined references to restgpr_*_x Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: al...@gcc.gnu.org CC: dje....@gmail.com, froy...@gcc.gnu.org, geo...@geoffk.org Target: powerpc intermediate compiler (built with -Os) trying to link a userspace program gives powerpc-oe-linux-uclibc-gcc -m32 -mhard-float -mcpu=603e powerpc-oe-linux-uclibc/4.7.1/ld: getconf: hidden symbol `_restgpr_31_x' in /scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr/lib/ppc603e-oe-linux-uclibc.gcc-cross-intermediate/gcc/powerpc-oe-linux-uclibc/4.7.1/libgcc.a(crtresxgpr.o) is referenced by DSO Observations: 1) libgcc_s.so is a script: "GROUP ( libgcc_s.so.1 libgcc.a )" 2) There are libcalls emitted into my libc: $ powerpc-oe-linux-uclibc-gcc -m32 -mhard-float -mcpu=603e --sysroot=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/qemuppc-tcbootstrap -Wl,-EB -shared -Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,relro -Wl,-z,now -Wl,--hash-style=gnu -Wl,-z,defs -Wl,-init,__uClibc_init -Wl,-soname=libc.so.0 -nostdlib -o lib/libuClibc-0.9.34-git.so -Wl,--whole-archive libc/libc_so.a -Wl,--no-whole-archive ./lib/interp.os ./lib/ld-uClibc.so.0 ./lib/uclibc_nonshared.a 2>&1 >&1 | sed -e 's/.*uClibc/OBJTREE/' libc/libc_so.a(fnmatch.os): In function `end_pattern': OBJTREE/libc/misc/fnmatch/fnmatch_loop.c:1014: undefined reference to `_restgpr_27_x' libc/libc_so.a(fnmatch.os): In function `internal_fnmatch': OBJTREE/libc/misc/fnmatch/fnmatch_loop.c:975: undefined reference to `_restgpr_16_x' libc/libc_so.a(fnmatch.os): In function `ext_match': OBJTREE/libc/misc/fnmatch/fnmatch_loop.c:1189: undefined reference to `_restgpr_14_x' libc/libc_so.a(regex.os): In function `postorder': OBJTREE/libc/misc/regex/regcomp.c:1167: undefined reference to `_restgpr_28_x' libc/libc_so.a(regex.os): In function `check_dst_limits_calc_pos_1': OBJTREE/libc/misc/regex/regexec.c:1914: undefined reference to `_restgpr_18_x' libc/libc_so.a(regex.os): In function `re_node_set_alloc': OBJTREE/libc/misc/regex/regex_internal.c:885: undefined reference to `_restgpr_29_x' libc/libc_so.a(regex.os): In function `duplicate_tree': OBJTREE/libc/misc/regex/regcomp.c:3779: undefined reference to `_restgpr_26_x' libc/libc_so.a(regex.os): In function `lower_subexp': OBJTREE/libc/misc/regex/regcomp.c:1288: undefined reference to `_restgpr_24_x' libc/libc_so.a(regex.os): In function `free_state': OBJTREE/libc/misc/regex/regex_internal.c:1499: undefined reference to `_savegpr_31' libc/libc_so.a(regex.os): In function `re_string_destruct': OBJTREE/libc/misc/regex/regex_internal.c:828: undefined reference to `_restgpr_31_x' libc/libc_so.a(regex.os): In function `re_dfa_add_node': OBJTREE/libc/misc/regex/regex_internal.c:1360: undefined reference to `_restgpr_22_x' libc/libc_so.a(regex.os): In function `build_wcs_buffer': OBJTREE/libc/misc/regex/regex_internal.c:257: undefined reference to `_restgpr_23_x' libc/libc_so.a(regex.os): In function `build_wcs_upper_buffer': OBJTREE/libc/misc/regex/regex_internal.c:473: undefined reference to `_restgpr_21_x' libc/libc_so.a(regex.os): In function `re_compile_fastmap_iter': OBJTREE/libc/misc/regex/regcomp.c:397: undefined reference to `_restgpr_17_x' libc/libc_so.a(regex.os): In function `re_node_set_init_union': OBJTREE/libc/misc/regex/regex_internal.c:1096: undefined reference to `_restgpr_25_x' libc/libc_so.a(regex.os): In function `sift_states_backward': OBJTREE/libc/misc/regex/regexec.c:1561: undefined reference to `_restgpr_15_x' libc/libc_so.a(regex.os): In function `expand_bkref_cache': OBJTREE/libc/misc/regex/regexec.c:3212: undefined reference to `_restgpr_20_x' libc/libc_so.a(regex.os): In function `re_compile_pattern': OBJTREE/libc/misc/regex/regcomp.c:233: undefined reference to `_restgpr_30_x' libc/libc_so.a(wordexp.os): In function `parse_arith': OBJTREE/libc/misc/wordexp/wordexp.c:751: undefined reference to `_restgpr_19_x' libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': OBJTREE/libc/stdio/_fpmaxtostr.c:189: undefined reference to `_savefpr_22' OBJTREE/libc/stdio/_fpmaxtostr.c:265: undefined reference to `__gcc_qdiv' OBJTREE/libc/stdio/_fpmaxtostr.c:278: undefined reference to `__gcc_qmul' OBJTREE/libc/stdio/_fpmaxtostr.c:375: undefined reference to `__gcc_qsub' OBJTREE/libc/stdio/_fpmaxtostr.c:376: undefined reference to `__gcc_qadd' OBJTREE/libc/stdio/_fpmaxtostr.c:748: undefined reference to `_restfpr_22_x' libc/libc_so.a(lldiv.os): In function `lldiv': OBJTREE/libc/stdlib/lldiv.c:30: undefined reference to `__divdi3' OBJTREE/libc/stdlib/lldiv.c:31: undefined reference to `__moddi3' libc/libc_so.a(__strtofpmax.os): In function `__strtofpmax': OBJTREE/libc/stdlib/_strtod.c:206: undefined reference to `_savefpr_28' OBJTREE/libc/stdlib/_strtod.c:471: undefined reference to `_restfpr_28_x' collect2: error: ld returned 1 exit status 3) to satisfy the libcalls we usually pull in those bits via -lgcc: $ powerpc-oe-linux-uclibc-gcc -m32 -mhard-float -mcpu=603e --sysroot=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/qemuppc-tcbootstrap -Wl,-EB -shared -Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,relro -Wl,-z,now -Wl,--hash-style=gnu -Wl,-z,defs -Wl,-init,__uClibc_init -Wl,-soname=libc.so.0 -nostdlib -o lib/libuClibc-0.9.34-git.so -Wl,--whole-archive libc/libc_so.a -Wl,--no-whole-archive ./lib/interp.os ./lib/ld-uClibc.so.0 ./lib/uclibc_nonshared.a -lgcc $ powerpc-oe-linux-uclibc-nm lib/libuClibc-0.9.34-git.so | grep "gpr" 00012a30 t __GI_sigprocmask 0005cb8c t _restgpr_14_x 0005cb90 t _restgpr_15_x 0005cb94 t _restgpr_16_x 0005cb98 t _restgpr_17_x 0005cb9c t _restgpr_18_x 0005cba0 t _restgpr_19_x 0005cba4 t _restgpr_20_x 0005cba8 t _restgpr_21_x 0005cbac t _restgpr_22_x 0005cbb0 t _restgpr_23_x 0005cbb4 t _restgpr_24_x 0005cbb8 t _restgpr_25_x 0005cbbc t _restgpr_26_x 0005cbc0 t _restgpr_27_x 0005cbc4 t _restgpr_28_x 0005cbc8 t _restgpr_29_x 0005cbcc t _restgpr_30_x 0005cbd0 t _restgpr_31_x 0005cae8 t _savegpr_14 0005caec t _savegpr_15 0005caf0 t _savegpr_16 0005caf4 t _savegpr_17 0005caf8 t _savegpr_18 0005cafc t _savegpr_19 0005cb00 t _savegpr_20 0005cb04 t _savegpr_21 0005cb08 t _savegpr_22 0005cb0c t _savegpr_23 0005cb10 t _savegpr_24 0005cb14 t _savegpr_25 0005cb18 t _savegpr_26 0005cb1c t _savegpr_27 0005cb20 t _savegpr_28 0005cb24 t _savegpr_29 0005cb28 t _savegpr_30 0005cb2c t _savegpr_31 00012a30 T sigprocmask This is obviously what the linker complains about above when linking a program against that library. Using -lgcc_s instead gives the same result. Questions: 1) What am i doing wrong? :) 2) I could +libc-static-y += $(ARCH_OUT)/gpr.o +libc-nonshared-y += $(ARCH_OUT)/gpr.o into libc which would contain _{rest,save}gpr{0,1}_{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,all} But that does not help me for the _x libcalls (?) 3) What about these restgpr_x calls, should those be plain _restgpr[01]_num, i.e. AIX_ABI(?!) ? rs6000.c rs6000_savres_routine_name() My compiler was Configured with: /scratch/obj.x86_64/oe/build/tmp-uclibc/work-shared/gcc-4.7.0+svnr186651-r2/gcc-4_7-branch/configure --build=x86_64-linux --host=x86_64-linux --target=powerpc-oe-linux-uclibc --prefix=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr --exec_prefix=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr --bindir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr/bin/ppc603e-oe-linux-uclibc.gcc-cross-intermediate --sbindir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr/bin/ppc603e-oe-linux-uclibc.gcc-cross-intermediate --libexecdir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr/libexec/ppc603e-oe-linux-uclibc.gcc-cross-intermediate --datadir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr/share --sysconfdir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/etc --sharedstatedir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/com --localstatedir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/var --libdir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr/lib/ppc603e-oe-linux-uclibc.gcc-cross-intermediate --includedir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr/include --oldincludedir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr/include --infodir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr/share/info --mandir=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/x86_64-linux --enable-shared --disable-multilib --disable-threads --enable-languages=c --program-prefix=powerpc-oe-linux-uclibc- --with-sysroot=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/qemuppc-tcbootstrap --with-build-sysroot=/scratch/obj.x86_64/oe/build/tmp-uclibc/sysroots/qemuppc-tcbootstrap --disable-libmudflap --disable-libgomp --disable-libquadmath --with-system-zlib --disable-lto --disable-plugin --disable-libssp --disable-nls --disable-decimal-float --enable-__cxa_atexit CC'ing Nathan as per http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810#c18 thanks in advance for any help,