View Issue Details

IDProjectCategoryView StatusLast Update
0000115Rocky-Linux-8gcc-toolset-11public2022-08-25 18:43
ReporterJason Vas Dias Assigned ToLouis Abel  
PriorityurgentSeveritymajorReproducibilityalways
Status closedResolutionwon't fix 
Summary0000115: g++ from gcc-toolset-11 v11-11.1-1 cannot compile 32-bit / -m32
Description
Creating a simple /tmp/t.C Hello World program and compiling it in 32-bit mode fails
with latest g++ from gcc-toolset-11-11.1-1.el8.x86_64 :

$ g++ -std=gnu++20 -x c++ -o t++ t.C
$ cat t.C
#include <iostream>
using namespace std;
int main( int argc, char *const *argv, char *const *envp)
{
  cout << "Hello World!" << endl;
  return 0;
}

$ which g++
/opt/rh/gcc-toolset-11/root/bin/g++
$ g++ -m32 -std=gnu++20 -x c++ -o t++ t.C
/opt/rh/gcc-toolset-11/root/bin/ld: skipping incompatible /opt/rh/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11/libstdc++_nonshared.a when searching for -lstdc++_nonshared
/opt/rh/gcc-toolset-11/root/bin/ld: cannot find -lstdc++_nonshared
collect2: error: ld returned 1 exit status

I HAD set my LD_LIBRARY_PATH to pick up /opt/rh/gcc-toolset-11/{usr/lib64,usr/lib/gcc/x86_64-redhat-linux/11{/32,}} :

$ echo $LD_LIBRARY_PATH
/opt/rh/gcc-toolset-11/root/usr/lib64:/opt/rh/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11/32:/opt/rh/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11


So, what is going on here is that the '-lstdc++_nonshared' library dependency
is being picked up from:
   /opt/rh/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11/32/libstdc++.so
which is a LINKER SCRIPT :
   $ cat libstdc++.so
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-i386)
INPUT ( /usr/lib/libstdc++.so.6 -lstdc++_nonshared )

So, I would suggest changing that, for the gcc-toolset-* builds only, to:
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-i386)
INPUT ( /usr/lib/libstdc++.so.6 /opt/rh/gcc-toolset-11/root/lib/gcc/x86_64-redhat-linux/11/32/libstdc++_nonshared.a )

I do not really see any way around having to make this change, since otherwise
the gcc-toolset-*-gcc C++ compilers JUST CANNOT compile at all for 32-bit.
The point is, programmers really do need to include ONLY that exact library, this is specified nowhere else in the
compiler '-dumpspecs' output .

And then if I do that, it still does not work, because you do not ship the gcc-toolset-11.{i686,i386} package !
And the links owned by the gcc-toolset-11 package point to non-existent files, in
/opt/rh/gcc-toolset-11/root/lib/gcc/x86_64-redhat-linux/11/32 :

lrwxrwxrwx. 1 root root 40 Apr 18 04:07 libubsan.a -> ../../../i686-redhat-linux/11/libubsan.a
-rw-r--r--. 1 root root 206 Apr 18 04:07 libstdc++.so.default
lrwxrwxrwx. 1 root root 51 Apr 18 04:07 libstdc++_nonshared.a -> ../../../i686-redhat-linux/11/libstdc++_nonshared.a
lrwxrwxrwx. 1 root root 43 Apr 18 04:07 libstdc++fs.a -> ../../../i686-redhat-linux/11/libstdc++fs.a
lrwxrwxrwx. 1 root root 41 Apr 18 04:07 libstdc++.a -> ../../../i686-redhat-linux/11/libstdc++.a
-rw-r--r--. 1 root root 82 Apr 18 04:07 libquadmath.so
lrwxrwxrwx. 1 root root 43 Apr 18 04:07 libquadmath.a -> ../../../i686-redhat-linux/11/libquadmath.a
-rw-r--r--. 1 root root 77 Apr 18 04:07 libitm.so
lrwxrwxrwx. 1 root root 38 Apr 18 04:07 libitm.a -> ../../../i686-redhat-linux/11/libitm.a
-rw-r--r--. 1 root root 78 Apr 18 04:07 libgomp.so
-rw-r--r--. 1 root root 210 Apr 18 04:07 libgfortran.so
lrwxrwxrwx. 1 root root 53 Apr 18 04:07 libgfortran_nonshared.a -> ../../../i686-redhat-linux/11/libgfortran_nonshared.a
-rw-r--r--. 1 root root 191 Apr 18 04:07 libgcc_s.so
-rw-r--r--. 1 root root 107 Apr 18 04:07 libgccjit.so
-rw-r--r--. 1 root root 80 Apr 18 04:07 libatomic.so
lrwxrwxrwx. 1 root root 41 Apr 18 04:07 libatomic.a -> ../../../i686-redhat-linux/11/libatomic.a
-rw-r--r--. 1 root root 78 Apr 18 04:07 libasan.so
lrwxrwxrwx. 1 root root 47 Apr 18 04:07 libasan_preinit.o -> ../../../i686-redhat-linux/11/libasan_preinit.o
lrwxrwxrwx. 1 root root 39 Apr 18 04:07 libasan.a -> ../../../i686-redhat-linux/11/libasan.a

you have not shipped the i686 builds of those libraries - where are they ?
I guess I have to build gcc-toolset-11 SRPM to find out.

 
Steps To ReproduceTry to build a 32-bit program with g++ from gcc-toolset-11 - it fails with 'libstdc++_nonshared' not found
TagsNo tags attached.

Activities

Louis Abel

Louis Abel

2022-06-02 18:22

administrator   ~0000215

Thank you for the report. Please note that we only ship in our repositories what Red Hat ships in their product Red Hat Enterprise Linux. This is why there is no i686 packages of the gcc-toolset-11-gcc package. If you really need that package, you can find it at kojidev.rockylinux.org.
Jason Vas Dias

Jason Vas Dias

2022-06-02 18:34

reporter   ~0000217

Aha ! I did :
 $ yum install gcc-toolset-11\*
and
 $ yum install $(repoquery --whatprovides /opt/rh/gcc-toolset-11/root/usr/lib/gcc/i686-redhat-linux)
and it started working ! (now that link targets are created).
It appears that the dependencies on the subset of gcc-toolset-11 did not draw in the required gcc/i686-redhat-linux owning RPMs,
and that somehow dangling links got created during install - bad !
Jason Vas Dias

Jason Vas Dias

2022-06-02 23:27

reporter   ~0000218

On a related issue, it appears that the gcc-toolset-11 g++ , with its /opt/rh/gcc-toolset-10/root/usr/include/c++/11/iostream file,
has a problem on 32-bit only, when building a SHARED LIBRARY with g++ flags '-nostdlib', in that the code contains a reference
to '__ioinit' on line 74, which resolves into code containing a reference to the GLIBC '.hidden' symbol '__dso_handle' ,
which then involves a disallowed static RELOCATION, no matter what -fPIC / -fpic flags are used.
This is when using its own /opt/rh/gcc-toolset-11/root/usr/bin/ld, which is binutils ld version 2.35.2-1.el8 , which SHOULD
be a later version of ld that DOES ignore static relocations on hidden / weak undefined symbols and allow them to be inserted.
It appears that ONLY when -nostdlib is NOT supplied, then the link works, because the '--plugin=-pass-through=-lc' , '--plugin=-pass-through=-lgcc_s'
GCC COLLECT options get specified for links that DO NOT specify -nostdlib, and this seems to be OK and makes ld then allow the relocation to be
inserted . This has the result that GMP 's libgmpxx cannot be built for i686 - and yes, it really needs to specify '-nostdlib', this is what it does OK
for x86_64 .
Some wrinkles like the above need to be ironed out in the core GCC of 'gcc-toolset-11' SRPM before I go ahead and use it to produce the 'cross-gcc' build,
which will duplicate all these issues.
But first I need to get gmp 6.2.1 i686 installed & latest mpfr, isl, mpc, et al in order to build it ...
Then I can use the knowledge gained to produce gcc-toolset-12 and clang-toolset-14 and llvm-toolset-14 SRPMs .
 
It should come with compiler .spec file stanzas that will fix these issues - I can think of one that would fix the above , and will post here.
Jason Vas Dias

Jason Vas Dias

2022-06-03 09:49

reporter   ~0000219

Close but no cigar.

All the libraries of GMP 32-bit now build, and the C tests run fine, but then on attempt to build first C++ test:

+ g++ -specs /tmp/g++32.specs -std=gnu++20 -x c++ -m32 -march=i686 -mtune=generic -O3 -g -fPIC -pipe -I/usr/local/include -D_FORTIFY_SOURCE=2 -D_G
LIBCXX_ASSERTIONS -fplugin=annobin -fpic -o t-binary t-binary.o -L../../.libs ../../tests/.libs/libtests.a ../../.libs/libgmpxx.so ../../.libs/libgmp.so ./../.libs/libgmp.so -lpthread -lrt -ldl -lc -lgcc_s -lm
t-binary.o:1:1: error: stray ‘\177’ in program
    1 | ELF @� 4 ( U T ^L H J # $ K . / 0 1

Oops! ld gets stuck in an infinite loop emitting binary garbage to the terminal. Why ? My spec files contain no \177 character ...
Jason Vas Dias

Jason Vas Dias

2022-06-03 09:55

reporter   ~0000220

Oops, sorry, previous comment referred to a previous comment that did not get posted.

Here is a GCC specs file, 'g++32.specs', modifying the original 'g++32-orig.specs' from the g++ of that does fix the problem of gcc-toolset-11-gcc-11.2.1-9.1.el8.x86_64's g++
not being able to link a 32-bit shared library, owing to a dependency on the GLIBC hidden global '__dso_handle' .

GMP 32-bit now builds, but gets to the first C++ test file and fails to build because ld 2.35.2-1 enters an infinite loop spitting garbage to the terminal.
Jason Vas Dias

Jason Vas Dias

2022-06-03 09:58

reporter   ~0000221

Oops, .specs files aren't uploaded, here are the .specs.txt files:
g++32-orig.specs.txt (9,759 bytes)   
*asm:
%{m16|m32:--32}  %{m16|m32|mx32:;:--64}  %{mx32:--x32}  %{msse2avx:%{!mavx:-msse2avx}}

*asm_debug:
%{%:debug-level-gt(0):%{gstabs*:--gstabs;:%{g*:}}} %{fdebug-prefix-map=*:--debug-prefix-map %*}

*asm_debug_option:
%{%:debug-level-gt(0):%{!gstabs*:%{g*:%{%:dwarf-version-gt(4):--gdwarf-5 ;%:dwarf-version-gt(3):--gdwarf-4 ;%:dwarf-version-gt(2):--gdwarf-3 ;:--gdwarf2 }}}}

*asm_final:
%{gsplit-dwarf: 
       objcopy --extract-dwo 	 %{c:%{o*:%*}%{!o*:%w%b%O}}%{!c:%U%O} 	 %b.dwo 
       objcopy --strip-dwo 	 %{c:%{o*:%*}%{!o*:%w%b%O}}%{!c:%U%O}     }

*asm_options:
%{-target-help:%:print-asm-header()} %{v} %{w:-W} %{I*} %(asm_debug_option) %{gz|gz=zlib:--compress-debug-sections=zlib} %{gz=none:--compress-debug-sections=none} %{gz=zlib-gnu:--compress-debug-sections=zlib-gnu} %a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}

*invoke_as:
%{!fwpa*:   %{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()}   %{!S:-o %|.s |
 as %(asm_options) %m.s %A }  }

*cpp:
%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}

*cpp_options:
%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w} %{f*} %{g*:%{%:debug-level-gt(0):%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*} %{undef} %{save-temps*:-fpch-preprocess}

*cpp_debug_options:
%<dumpdir %<dumpbase %<dumpbase-ext %{d*} %:dumps()

*cpp_unique_options:
%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %@{I*&F*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{Mmodules} %{Mno-modules} %{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}} %{remap} %{%:debug-level-gt(2):-dD} %{!iplugindir*:%{fplugin*:%:find-plugindir()}} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{E|M|MM:%W{o*}}

*trad_capable_cpp:
cc1 -E %{traditional|traditional-cpp:-traditional-cpp}

*cc1:
%{!mandroid|tno-android-cc:%(cc1_cpu) %{profile:-p};:%(cc1_cpu) %{profile:-p} %{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} %{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}}

*cc1_options:
%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %{!iplugindir*:%{fplugin*:%:find-plugindir()}} %1 %{!Q:-quiet} %(cpp_debug_options) %{m*} %{aux-info*} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{Qy:} %{-help:--help} %{-target-help:--target-help} %{-version:--version} %{-help=*:--help=%*} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}} %{fsyntax-only:-o %j} %{-param*} %{coverage:-fprofile-arcs -ftest-coverage} %{fprofile-arcs|fprofile-generate*|coverage:   %{!fprofile-update=single:     %{pthread:-fprofile-update=prefer-atomic}}}

*cc1plus:


*link_gcc_c_sequence:
%{static|static-pie:--start-group} %G %{!nolibc:%L}    %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}

*link_ssp:
%{fstack-protector|fstack-protector-all|fstack-protector-strong|fstack-protector-explicit:}

*endfile:
%{!mandroid|tno-android-ld:%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}    %{mpc32:crtprec32.o%s}    %{mpc64:crtprec64.o%s}    %{mpc80:crtprec80.o%s} %{!static:%{fvtable-verify=none:%s;      fvtable-verify=preinit:vtv_end_preinit.o%s;      fvtable-verify=std:vtv_end.o%s}}    %{static:crtend.o%s;      shared|static-pie|pie:crtendS.o%s;      :crtend.o%s} crtn.o%s %{fopenacc|fopenmp:crtoffloadend%O%s};:%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}    %{mpc32:crtprec32.o%s}    %{mpc64:crtprec64.o%s}    %{mpc80:crtprec80.o%s} %{shared: crtend_so%O%s;: crtend_android%O%s}}

*link:
%{!r:--build-id} --no-add-needed %{!static|static-pie:--eh-frame-hdr} --hash-style=gnu %{!mandroid|tno-android-ld:%{m16|m32|mx32:;:-m elf_x86_64}                    %{m16|m32:-m elf_i386}                    %{mx32:-m elf32_x86_64}   %{shared:-shared}   %{!shared:     %{!static:       %{!static-pie: 	%{rdynamic:-export-dynamic} 	%{m16|m32:-dynamic-linker %{muclibc:/lib/ld-uClibc.so.0;:%{mbionic:/system/bin/linker;:%{mmusl:/lib/ld-musl-i386.so.1;:/lib/ld-linux.so.2}}}} 	%{m16|m32|mx32:;:-dynamic-linker %{muclibc:/lib/ld64-uClibc.so.0;:%{mbionic:/system/bin/linker64;:%{mmusl:/lib/ld-musl-x86_64.so.1;:/lib64/ld-linux-x86-64.so.2}}}} 	%{mx32:-dynamic-linker %{muclibc:/lib/ldx32-uClibc.so.0;:%{mbionic:/system/bin/linkerx32;:%{mmusl:/lib/ld-musl-x32.so.1;:/libx32/ld-linux-x32.so.2}}}}}}     %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}};:%{m16|m32|mx32:;:-m elf_x86_64}                    %{m16|m32:-m elf_i386}                    %{mx32:-m elf32_x86_64}   %{shared:-shared}   %{!shared:     %{!static:       %{!static-pie: 	%{rdynamic:-export-dynamic} 	%{m16|m32:-dynamic-linker %{muclibc:/lib/ld-uClibc.so.0;:%{mbionic:/system/bin/linker;:%{mmusl:/lib/ld-musl-i386.so.1;:/lib/ld-linux.so.2}}}} 	%{m16|m32|mx32:;:-dynamic-linker %{muclibc:/lib/ld64-uClibc.so.0;:%{mbionic:/system/bin/linker64;:%{mmusl:/lib/ld-musl-x86_64.so.1;:/lib64/ld-linux-x86-64.so.2}}}} 	%{mx32:-dynamic-linker %{muclibc:/lib/ldx32-uClibc.so.0;:%{mbionic:/system/bin/linkerx32;:%{mmusl:/lib/ld-musl-x32.so.1;:/libx32/ld-linux-x32.so.2}}}}}}     %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}} %{shared: -Bsymbolic}}

*lib:
%{!mandroid|tno-android-ld:%{pthread:-lpthread} %{shared:-lc}    %{!shared:%{profile:-lc_p}%{!profile:-lc}};:%{shared:-lc}    %{!shared:%{profile:-lc_p}%{!profile:-lc}} %{!static: -ldl}}

*link_gomp:


*libgcc:
%{static|static-libgcc|static-pie:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!static-pie:%{!shared-libgcc:-lgcc --push-state --as-needed -lgcc_s --pop-state}%{shared-libgcc:-lgcc_s%{!shared: -lgcc}}}}}

*startfile:
%{!mandroid|tno-android-ld:%{shared:;      pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s};      static:crt1.o%s;      static-pie:rcrt1.o%s;      pie:Scrt1.o%s;      :crt1.o%s} crti.o%s    %{static:crtbeginT.o%s;      shared|static-pie|pie:crtbeginS.o%s;      :crtbegin.o%s}    %{fvtable-verify=none:%s;      fvtable-verify=preinit:vtv_start_preinit.o%s;      fvtable-verify=std:vtv_start.o%s} %{fopenacc|fopenmp:crtoffloadbegin%O%s};:%{shared: crtbegin_so%O%s;:  %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}}

*cross_compile:
0

*version:
11.2.1

*multilib:
. !m64 !m32;64:../lib64 m64 !m32;32:../lib !m64 m32;

*multilib_defaults:
m64

*multilib_extra:


*multilib_matches:
m64 m64;m32 m32;

*multilib_exclusions:


*multilib_options:
m64/m32

*multilib_reuse:


*linker:
collect2

*linker_plugin_file:


*lto_wrapper:


*lto_gcc:


*post_link:


*link_libgcc:
%D

*md_exec_prefix:


*md_startfile_prefix:


*md_startfile_prefix_1:


*startfile_prefix_spec:


*sysroot_spec:
--sysroot=%R

*sysroot_suffix_spec:


*sysroot_hdrs_suffix_spec:


*self_spec:


*cc1_cpu:
%{march=native:%>march=native %:local_cpu_detect(arch %{!m32:64;:32})   %{!mtune=*:%>mtune=native %:local_cpu_detect(tune %{!m32:64;:32})}} %{mtune=native:%>mtune=native %:local_cpu_detect(tune %{!m32:64;:32})}

*link_command:
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:    %(linker) %{!fno-use-linker-plugin:%{!fno-lto:     -plugin %(linker_plugin_file)     -plugin-opt=%(lto_wrapper)     -plugin-opt=-fresolution=%u.res         %{flinker-output=*:-plugin-opt=-linker-output-known}     %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}}     }}%{flto|flto=*:%<fcompare-debug*}     %{flto} %{fno-lto} %{flto=*} %l %{static|shared|r:;pie:-pie} %{fuse-ld=*:-fuse-ld=%*}  %{gz|gz=zlib:--compress-debug-sections=zlib} %{gz=none:--compress-debug-sections=none} %{gz=zlib-gnu:--compress-debug-sections=zlib-gnu} %X %{o*} %{e*} %{N} %{n} %{r}    %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}}     %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) %{fvtable-verify=none:} %{fvtable-verify=std:   %e-fvtable-verify=std is not supported in this configuration} %{fvtable-verify=preinit:   %e-fvtable-verify=preinit is not supported in this configuration} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):%{!shared:libasan_preinit%O%s} %{static-libasan:%{!shared:-Bstatic --whole-archive -lasan --no-whole-archive -Bdynamic}}%{!static-libasan:-lasan}}     %{%:sanitize(hwaddress):%{static-libhwasan:%{!shared:-Bstatic --whole-archive -lhwasan --no-whole-archive -Bdynamic}}%{!static-libhwasan:-lhwasan}}     %{%:sanitize(thread):%{!shared:libtsan_preinit%O%s} %{static-libtsan:%{!shared:-Bstatic --whole-archive -ltsan --no-whole-archive -Bdynamic}}%{!static-libtsan:-ltsan}}     %{%:sanitize(leak):%{!shared:liblsan_preinit%O%s} %{static-liblsan:%{!shared:-Bstatic --whole-archive -llsan --no-whole-archive -Bdynamic}}%{!static-liblsan:-llsan}}}}} %o      %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):	%:include(libgomp.spec)%(link_gomp)}    %{fgnu-tm:%:include(libitm.spec)%(link_itm)}    %(mflib)  %{fsplit-stack: --wrap=pthread_create}    %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address): %{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)}    %{static:%ecannot specify -static with -fsanitize=address}}    %{%:sanitize(hwaddress): %{static-libhwasan|static:%:include(libsanitizer.spec)%(link_libhwasan)}	%{static:%ecannot specify -static with -fsanitize=hwaddress}}    %{%:sanitize(thread): %{static-libtsan|static:%:include(libsanitizer.spec)%(link_libtsan)}    %{static:%ecannot specify -static with -fsanitize=thread}}    %{%:sanitize(undefined):%{static-libubsan:-Bstatic} -lubsan %{static-libubsan:-Bdynamic} %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}}    %{%:sanitize(leak): %{static-liblsan|static:%:include(libsanitizer.spec)%(link_liblsan)}}}}}     %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}    %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*}  
%(post_link) }}}}}}

g++32-orig.specs.txt (9,759 bytes)   
g++32.specs.txt (9,979 bytes)   
*asm:
%{m16|m32:--32}  %{m16|m32|mx32:;:--64}  %{mx32:--x32}  %{msse2avx:%{!mavx:-msse2avx}}

*asm_debug:
%{%:debug-level-gt(0):%{gstabs*:--gstabs;:%{g*:}}} %{fdebug-prefix-map=*:--debug-prefix-map %*}

*asm_debug_option:
%{%:debug-level-gt(0):%{!gstabs*:%{g*:%{%:dwarf-version-gt(4):--gdwarf-5 ;%:dwarf-version-gt(3):--gdwarf-4 ;%:dwarf-version-gt(2):--gdwarf-3 ;:--gdwarf2 }}}}

*asm_final:
%{gsplit-dwarf: 
       objcopy --extract-dwo 	 %{c:%{o*:%*}%{!o*:%w%b%O}}%{!c:%U%O} 	 %b.dwo 
       objcopy --strip-dwo 	 %{c:%{o*:%*}%{!o*:%w%b%O}}%{!c:%U%O}     }

*asm_options:
%{-target-help:%:print-asm-header()} %{v} %{w:-W} %{I*} %(asm_debug_option) %{gz|gz=zlib:--compress-debug-sections=zlib} %{gz=none:--compress-debug-sections=none} %{gz=zlib-gnu:--compress-debug-sections=zlib-gnu} %a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}

*invoke_as:
%{!fwpa*:   %{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()}   %{!S:-o %|.s |
 as %(asm_options) %m.s %A }  }

*cpp:
%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}

*cpp_options:
%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w} %{f*} %{g*:%{%:debug-level-gt(0):%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*} %{undef} %{save-temps*:-fpch-preprocess}

*cpp_debug_options:
%<dumpdir %<dumpbase %<dumpbase-ext %{d*} %:dumps()

*cpp_unique_options:
%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %@{I*&F*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{Mmodules} %{Mno-modules} %{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}} %{remap} %{%:debug-level-gt(2):-dD} %{!iplugindir*:%{fplugin*:%:find-plugindir()}} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{E|M|MM:%W{o*}}

*trad_capable_cpp:
cc1 -E %{traditional|traditional-cpp:-traditional-cpp}

*cc1:
%{!mandroid|tno-android-cc:%(cc1_cpu) %{profile:-p};:%(cc1_cpu) %{profile:-p} %{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} %{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}}

*cc1_options:
%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %{!iplugindir*:%{fplugin*:%:find-plugindir()}} %1 %{!Q:-quiet} %(cpp_debug_options) %{m*} %{aux-info*} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{Qy:} %{-help:--help} %{-target-help:--target-help} %{-version:--version} %{-help=*:--help=%*} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}} %{fsyntax-only:-o %j} %{-param*} %{coverage:-fprofile-arcs -ftest-coverage} %{fprofile-arcs|fprofile-generate*|coverage:   %{!fprofile-update=single:     %{pthread:-fprofile-update=prefer-atomic}}}

*cc1plus:


*link_gcc_c_sequence:
%{static|static-pie:--start-group} %G %{!nolibc:%L}    %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}

*link_ssp:
%{fstack-protector|fstack-protector-all|fstack-protector-strong|fstack-protector-explicit:}

*endfile:
%{!mandroid|tno-android-ld:%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}    %{mpc32:crtprec32.o%s}    %{mpc64:crtprec64.o%s}    %{mpc80:crtprec80.o%s} %{!static:%{fvtable-verify=none:%s;      fvtable-verify=preinit:vtv_end_preinit.o%s;      fvtable-verify=std:vtv_end.o%s}}    %{static:crtend.o%s;      shared|static-pie|pie:crtendS.o%s;      :crtend.o%s} crtn.o%s %{fopenacc|fopenmp:crtoffloadend%O%s};:%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}    %{mpc32:crtprec32.o%s}    %{mpc64:crtprec64.o%s}    %{mpc80:crtprec80.o%s} %{shared: crtend_so%O%s;: crtend_android%O%s}}

*link:
%{!r:--build-id} --no-add-needed %{!static|static-pie:--eh-frame-hdr} --hash-style=gnu %{!mandroid|tno-android-ld:%{m16|m32|mx32:;:-m elf_x86_64}                    %{m16|m32:-m elf_i386}                    %{mx32:-m elf32_x86_64}   %{shared:-shared}   %{!shared:     %{!static:       %{!static-pie: 	%{rdynamic:-export-dynamic} 	%{m16|m32:-dynamic-linker %{muclibc:/lib/ld-uClibc.so.0;:%{mbionic:/system/bin/linker;:%{mmusl:/lib/ld-musl-i386.so.1;:/lib/ld-linux.so.2}}}} 	%{m16|m32|mx32:;:-dynamic-linker %{muclibc:/lib/ld64-uClibc.so.0;:%{mbionic:/system/bin/linker64;:%{mmusl:/lib/ld-musl-x86_64.so.1;:/lib64/ld-linux-x86-64.so.2}}}} 	%{mx32:-dynamic-linker %{muclibc:/lib/ldx32-uClibc.so.0;:%{mbionic:/system/bin/linkerx32;:%{mmusl:/lib/ld-musl-x32.so.1;:/libx32/ld-linux-x32.so.2}}}}}}     %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}};:%{m16|m32|mx32:;:-m elf_x86_64}                    %{m16|m32:-m elf_i386}                    %{mx32:-m elf32_x86_64}   %{shared:-shared}   %{!shared:     %{!static:       %{!static-pie: 	%{rdynamic:-export-dynamic} 	%{m16|m32:-dynamic-linker %{muclibc:/lib/ld-uClibc.so.0;:%{mbionic:/system/bin/linker;:%{mmusl:/lib/ld-musl-i386.so.1;:/lib/ld-linux.so.2}}}} 	%{m16|m32|mx32:;:-dynamic-linker %{muclibc:/lib/ld64-uClibc.so.0;:%{mbionic:/system/bin/linker64;:%{mmusl:/lib/ld-musl-x86_64.so.1;:/lib64/ld-linux-x86-64.so.2}}}} 	%{mx32:-dynamic-linker %{muclibc:/lib/ldx32-uClibc.so.0;:%{mbionic:/system/bin/linkerx32;:%{mmusl:/lib/ld-musl-x32.so.1;:/libx32/ld-linux-x32.so.2}}}}}}     %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}} %{shared: -Bsymbolic}}

*lib:
%{!mandroid|tno-android-ld:%{pthread:-lpthread} %{shared:-lc}    %{!shared:%{profile:-lc_p}%{!profile:-lc}};:%{shared:-lc}    %{!shared:%{profile:-lc_p}%{!profile:-lc}} %{!static: -ldl}}

*link_gomp:


*libgcc:
%{static|static-libgcc|static-pie:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!static-pie:%{!shared-libgcc:-lgcc --push-state --as-needed -lgcc_s --pop-state}%{shared-libgcc:-lgcc_s%{!shared: -lgcc}}}}}

*startfile:
%{!mandroid|tno-android-ld:%{shared:;      pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s};      static:crt1.o%s;      static-pie:rcrt1.o%s;      pie:Scrt1.o%s;      :crt1.o%s} crti.o%s    %{static:crtbeginT.o%s;      shared|static-pie|pie:crtbeginS.o%s;      :crtbegin.o%s}    %{fvtable-verify=none:%s;      fvtable-verify=preinit:vtv_start_preinit.o%s;      fvtable-verify=std:vtv_start.o%s} %{fopenacc|fopenmp:crtoffloadbegin%O%s};:%{shared: crtbegin_so%O%s;:  %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}}

*cross_compile:
0

*version:
11.2.1

*multilib:
. !m64 !m32;64:../lib64 m64 !m32;32:../lib !m64 m32;

*multilib_defaults:
m64

*multilib_extra:


*multilib_matches:
m64 m64;m32 m32;

*multilib_exclusions:


*multilib_options:
m64/m32

*multilib_reuse:


*linker:
collect2

*linker_plugin_file:


*lto_wrapper:


*lto_gcc:


*post_link:


*link_libgcc:
%D

*md_exec_prefix:


*md_startfile_prefix:


*md_startfile_prefix_1:


*startfile_prefix_spec:


*sysroot_spec:
--sysroot=%R

*sysroot_suffix_spec:


*sysroot_hdrs_suffix_spec:


*self_spec:


*cc1_cpu:
%{march=native:%>march=native %:local_cpu_detect(arch %{!m32:64;:32})   %{!mtune=*:%>mtune=native %:local_cpu_detect(tune %{!m32:64;:32})}} %{mtune=native:%>mtune=native %:local_cpu_detect(tune %{!m32:64;:32})}

*link_command:
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:    %(linker) %{!fno-use-linker-plugin:%{!fno-lto:     -plugin %(linker_plugin_file)     -plugin-opt=%(lto_wrapper)     -plugin-opt=-fresolution=%u.res         %{flinker-output=*:-plugin-opt=-linker-output-known}     %{!nostdlib:%{!nodefaultlibs:%{!shared:%:pass-through-libs(%(link_gcc_c_sequence))}}}	%{shared:%:pass-through-libs(%(link_gcc_c_sequence))}     }}%{flto|flto=*:%<fcompare-debug*}     %{flto} %{fno-lto} %{flto=*} %l %{static|shared|r:;pie:-pie} %{fuse-ld=*:-fuse-ld=%*}  %{gz|gz=zlib:--compress-debug-sections=zlib} %{gz=none:--compress-debug-sections=none} %{gz=zlib-gnu:--compress-debug-sections=zlib-gnu} %X %{o*} %{e*} %{N} %{n} %{r}    %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!shared:%{!r:%{!nostartfiles:%S}}}}  %{shared:%{!r:%{!nostartfiles:%S}}}     %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) %{fvtable-verify=none:} %{fvtable-verify=std:   %e-fvtable-verify=std is not supported in this configuration} %{fvtable-verify=preinit:   %e-fvtable-verify=preinit is not supported in this configuration} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):%{!shared:libasan_preinit%O%s} %{static-libasan:%{!shared:-Bstatic --whole-archive -lasan --no-whole-archive -Bdynamic}}%{!static-libasan:-lasan}}     %{%:sanitize(hwaddress):%{static-libhwasan:%{!shared:-Bstatic --whole-archive -lhwasan --no-whole-archive -Bdynamic}}%{!static-libhwasan:-lhwasan}}     %{%:sanitize(thread):%{!shared:libtsan_preinit%O%s} %{static-libtsan:%{!shared:-Bstatic --whole-archive -ltsan --no-whole-archive -Bdynamic}}%{!static-libtsan:-ltsan}}     %{%:sanitize(leak):%{!shared:liblsan_preinit%O%s} %{static-liblsan:%{!shared:-Bstatic --whole-archive -llsan --no-whole-archive -Bdynamic}}%{!static-liblsan:-llsan}}}}} %o      %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):	%:include(libgomp.spec)%(link_gomp)}    %{fgnu-tm:%:include(libitm.spec)%(link_itm)}    %(mflib)  %{fsplit-stack: --wrap=pthread_create}    %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address): %{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)}    %{static:%ecannot specify -static with -fsanitize=address}}    %{%:sanitize(hwaddress): %{static-libhwasan|static:%:include(libsanitizer.spec)%(link_libhwasan)}	%{static:%ecannot specify -static with -fsanitize=hwaddress}}    %{%:sanitize(thread): %{static-libtsan|static:%:include(libsanitizer.spec)%(link_libtsan)}    %{static:%ecannot specify -static with -fsanitize=thread}}    %{%:sanitize(undefined):%{static-libubsan:-Bstatic} -lubsan %{static-libubsan:-Bdynamic} %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}}    %{%:sanitize(leak): %{static-liblsan|static:%:include(libsanitizer.spec)%(link_liblsan)}}}}}     %{!nostdlib:%{!r:%{!nodefaultlibs:%{!shared:%(link_ssp) %(link_gcc_c_sequence)}}}}	%{shared:%{!r:%(link_ssp) %(link_gcc_c_sequence)}}	%{!nostdlib:%{!r:%{!nostartfiles:%{!shared:%E}}}}  %{shared:%{!r:%{!nostartfiles:%E}}} %{T*}  
%(post_link) }}}}}}

g++32.specs.txt (9,979 bytes)   
Jason Vas Dias

Jason Vas Dias

2022-06-03 09:59

reporter   ~0000222

$ diff -U0 g++32-orig.specs.txt g++32.specs.txt
--- g++32-orig.specs.txt 2022-06-03 10:22:03.609965338 +0100
+++ g++32.specs.txt 2022-06-03 10:22:03.728964673 +0100
@@ -143 +143 @@
-%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{!fno-use-linker-plugin:%{!fno-lto: -plugin %(linker_plugin_file) -plugin-opt=%(lto_wrapper) -plugin-opt=-fresolution=%u.res %{flinker-output=*:-plugin-opt=-linker-output-known} %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} }}%{flto|flto=*:%<fcompare-debug*} %{flto} %{fno-lto} %{flto=*} %l %{static|shared|r:;pie:-pie} %{fuse-ld=*:-fuse-ld=%*} %{gz|gz=zlib:--compress-debug-sections=zlib} %{gz=none:--compress-debug-sections=none} %{gz=zlib-gnu:--compress-debug-sections=zlib-gnu} %X %{o*} %{e*} %{N} %{n} %{r} %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) %{fvtable-verify=none:} %{fvtable-verify=std: %e-fvtable-verify=std is not supported in this configuration} %{fvtable-verify=preinit: %e-fvtable-verify=preinit is not supported in this configuration} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):%{!shared:libasan_preinit%O%s} %{static-libasan:%{!shared:-Bstatic --whole-archive -lasan --no-whole-archive -Bdynamic}}%{!static-libasan:-lasan}} %{%:sanitize(hwaddress):%{static-libhwasan:%{!shared:-Bstatic --whole-archive -lhwasan --no-whole-archive -Bdynamic}}%{!static-libhwasan:-lhwasan}} %{%:sanitize(thread):%{!shared:libtsan_preinit%O%s} %{static-libtsan:%{!shared:-Bstatic --whole-archive -ltsan --no-whole-archive -Bdynamic}}%{!static-libtsan:-ltsan}} %{%:sanitize(leak):%{!shared:liblsan_preinit%O%s} %{static-liblsan:%{!shared:-Bstatic --whole-archive -llsan --no-whole-archive -Bdynamic}}%{!static-liblsan:-llsan}}}}} %o %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): %:include(libgomp.spec)%(link_gomp)} %{fgnu-tm:%:include(libitm.spec)%(link_itm)} %(mflib) %{fsplit-stack: --wrap=pthread_create} %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address): %{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)} %{static:%ecannot specify -static with -fsanitize=address}} %{%:sanitize(hwaddress): %{static-libhwasan|static:%:include(libsanitizer.spec)%(link_libhwasan)} %{static:%ecannot specify -static with -fsanitize=hwaddress}} %{%:sanitize(thread): %{static-libtsan|static:%:include(libsanitizer.spec)%(link_libtsan)} %{static:%ecannot specify -static with -fsanitize=thread}} %{%:sanitize(undefined):%{static-libubsan:-Bstatic} -lubsan %{static-libubsan:-Bdynamic} %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}} %{%:sanitize(leak): %{static-liblsan|static:%:include(libsanitizer.spec)%(link_liblsan)}}}}} %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}} %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*}
+%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{!fno-use-linker-plugin:%{!fno-lto: -plugin %(linker_plugin_file) -plugin-opt=%(lto_wrapper) -plugin-opt=-fresolution=%u.res %{flinker-output=*:-plugin-opt=-linker-output-known} %{!nostdlib:%{!nodefaultlibs:%{!shared:%:pass-through-libs(%(link_gcc_c_sequence))}}} %{shared:%:pass-through-libs(%(link_gcc_c_sequence))} }}%{flto|flto=*:%<fcompare-debug*} %{flto} %{fno-lto} %{flto=*} %l %{static|shared|r:;pie:-pie} %{fuse-ld=*:-fuse-ld=%*} %{gz|gz=zlib:--compress-debug-sections=zlib} %{gz=none:--compress-debug-sections=none} %{gz=zlib-gnu:--compress-debug-sections=zlib-gnu} %X %{o*} %{e*} %{N} %{n} %{r} %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!shared:%{!r:%{!nostartfiles:%S}}}} %{shared:%{!r:%{!nostartfiles:%S}}} %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) %{fvtable-verify=none:} %{fvtable-verify=std: %e-fvtable-verify=std is not supported in this configuration} %{fvtable-verify=preinit: %e-fvtable-verify=preinit is not supported in this configuration} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):%{!shared:libasan_preinit%O%s} %{static-libasan:%{!shared:-Bstatic --whole-archive -lasan --no-whole-archive -Bdynamic}}%{!static-libasan:-lasan}} %{%:sanitize(hwaddress):%{static-libhwasan:%{!shared:-Bstatic --whole-archive -lhwasan --no-whole-archive -Bdynamic}}%{!static-libhwasan:-lhwasan}} %{%:sanitize(thread):%{!shared:libtsan_preinit%O%s} %{static-libtsan:%{!shared:-Bstatic --whole-archive -ltsan --no-whole-archive -Bdynamic}}%{!static-libtsan:-ltsan}} %{%:sanitize(leak):%{!shared:liblsan_preinit%O%s} %{static-liblsan:%{!shared:-Bstatic --whole-archive -llsan --no-whole-archive -Bdynamic}}%{!static-liblsan:-llsan}}}}} %o %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): %:include(libgomp.spec)%(link_gomp)} %{fgnu-tm:%:include(libitm.spec)%(link_itm)} %(mflib) %{fsplit-stack: --wrap=pthread_create} %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address): %{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)} %{static:%ecannot specify -static with -fsanitize=address}} %{%:sanitize(hwaddress): %{static-libhwasan|static:%:include(libsanitizer.spec)%(link_libhwasan)} %{static:%ecannot specify -static with -fsanitize=hwaddress}} %{%:sanitize(thread): %{static-libtsan|static:%:include(libsanitizer.spec)%(link_libtsan)} %{static:%ecannot specify -static with -fsanitize=thread}} %{%:sanitize(undefined):%{static-libubsan:-Bstatic} -lubsan %{static-libubsan:-Bdynamic} %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}} %{%:sanitize(leak): %{static-liblsan|static:%:include(libsanitizer.spec)%(link_liblsan)}}}}} %{!nostdlib:%{!r:%{!nodefaultlibs:%{!shared:%(link_ssp) %(link_gcc_c_sequence)}}}} %{shared:%{!r:%(link_ssp) %(link_gcc_c_sequence)}} %{!nostdlib:%{!r:%{!nostartfiles:%{!shared:%E}}}} %{shared:%{!r:%{!nostartfiles:%E}}} %{T*}
Jason Vas Dias

Jason Vas Dias

2022-06-03 10:02

reporter   ~0000223

So the change simply attempts to say that if we are building a shared library, ignore -nodefaultlib or -nostdlib .
To me this is preferable to patching GMP to NOT supply -nostdlib in its aclocal.m4 for x86_64 -
GCC spec is much clearer and simpler than M4 .
Jason Vas Dias

Jason Vas Dias

2022-06-03 10:04

reporter   ~0000224

But it certainly looks like GMP needs patching to make its tests use '-lgmp -lgmpxx' instead of specifying their whole paths -
I think one of those libraries is being interpreted as a source file.
Jason Vas Dias

Jason Vas Dias

2022-06-03 11:59

reporter   ~0000225

Yes, this is a LD or GCC bug - it is NOT caused by my specs file, because compiling WITHOUT specs file, and WITH the hard library paths translated into -l references:

$ g++ -std=gnu++20 -x c++ -m32 -march=i686 -mtune=generic -O3 -g -fPIC -pipe -I/usr/local/include -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -fplugin=annobin -fpic -o t-binary t-binary.o -L../../.libs -ltest -lgmp -lgmpxx ./../.libs/libgmp.so -lpthread -lrt -ldl -lc -lgcc_s -lm 2>&1 | tee /tmp/log
t-binary.o:1:1: error: stray ‘\177’ in program
    1 | ELF @� 4 ( U T ^L H J # $ K . / 0 1

Obviously, the breakage of 32-bit C++ builds due to static relocations owing to unresolved weak / hidden glibc symbol references was probably semi-intentional,
to prevent libraries such as the libgmpxx.so.4.6.1 produced from being produced, because now they are allowed , they cannot be linked to :-(

This smells like code in 'ld(1)' is avoiding / hiding this bug it has when implementing relocations to resolve weak / hidden undefined symbols ;
yet I can see the '__dso_handle' 'd' type symbol in glibc with 'nm', so there is really no reason it should have a problem - the symbol info is there!
There obviously needs to be more work in ld(1) to handle this. I guess I'll have raise a binutils bug about this , and raise UPSTREAM
binutils (RedHat and GNU) bugs about this, and use the Rocky bug to keep track ;

I think temporarily until the upstream fixes arrive I will HAVE to fix this ld(1) bug with something,
because the whole point of our Rocky Build Server is to build our @ 2GB of i686 code and
enable us to move on to pure 64-bit builds eventually .
Jason Vas Dias

Jason Vas Dias

2022-06-03 12:12

reporter   ~0000226

OK, here is output of running:

$ g++ --verbose -Wl,--verbose -std=gnu++20 -x c++ -m32 -march=i686 -mtune=generic -O3 -g -fPIC -pipe -I/usr/local/include -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -fplugin=annobin -fpic -o t-binary t-binary.o -L../../.libs -ltest -lgmp -lgmpxx ./../.libs/libgmp.so -lpthread -lrt -ldl -lc -lgcc_s -lm 2>&1 | tee /tmp/log
# <crash>
$ more /tmp/log
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/rh/gcc-toolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/gcc-toolset-11/root/usr --mandir=/opt/rh/gc
c-toolset-11/root/usr/share/man --infodir=/opt/rh/gcc-toolset-11/root/usr/share/info --with-bugurl=https://bugs.rockylinux.org/ --enable-shared --
enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-
gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --wi
th-isl=/builddir/build/BUILD/gcc-11.2.1-20220127/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --e
nable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.1 20220127 (Red Hat 11.2.1-9) (GCC)
COLLECT_GCC_OPTIONS='-v' '-std=gnu++20' '-m32' '-march=i686' '-mtune=generic' '-O3' '-g' '-pipe' '-I' '/usr/local/include' '-D' '_FORTIFY_SOURCE=2
' '-D' '_GLIBCXX_ASSERTIONS' '-fplugin=annobin' '-fpic' '-o' 't-binary' '-L../../.libs' '-shared-libgcc' '-dumpdir' 't-binary-'
 /opt/rh/gcc-toolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/cc1plus -quiet -v -I /usr/local/include -imultilib 32 -iplugindir=/opt/rh/gcc-
toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11/plugin -D_GNU_SOURCE -D _FORTIFY_SOURCE=2 -D _GLIBCXX_ASSERTIONS t-binary.o -iplugindir=/opt/rh
/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11/plugin -quiet -dumpdir t-binary- -dumpbase t-binary.o -dumpbase-ext .o -m32 -march=i686 -m
tune=generic -g -O3 -std=gnu++20 -version -fplugin=annobin -fpic -o - |
 as -v -I /usr/local/include --gdwarf-4 --32 -o /tmp/ccjoYRw0.o
GNU assembler version 2.36.1 (x86_64-redhat-linux) using BFD version version 2.36.1-2.el8
GNU C++20 (GCC) version 11.2.1 20220127 (Red Hat 11.2.1-9) (x86_64-redhat-linux)
        compiled by GNU C version 11.2.1 20220127 (Red Hat 11.2.1-9), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.1.0, isl version isl
-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Versions of loaded plugins:
 annobin: Version 1023
ignoring nonexistent directory "/opt/rh/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11/include-fixed"
ignoring nonexistent directory "/opt/rh/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11/../../../../x86_64-redhat-linux/include"
ignoring duplicate directory "/usr/local/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /opt/rh/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11
 /opt/rh/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/x86_64-redhat-linux/32
 /opt/rh/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/backward
 /opt/rh/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11/include
 /usr/local/include
 /opt/rh/gcc-toolset-11/root/usr/include
 /usr/include
End of search list.
GNU C++20 (GCC) version 11.2.1 20220127 (Red Hat 11.2.1-9) (x86_64-redhat-linux)
        compiled by GNU C version 11.2.1 20220127 (Red Hat 11.2.1-9), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.1.0, isl version isl
-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Versions of loaded plugins:
 annobin: Version 1023
Compiler executable checksum: 3938eefb3cb425a050d77103ae6dbd6a
t-binary.o:1:1: error: stray ‘\177’ in program
    1 | ELF @� 4 ( U T ^L H J # $ K . / 0 1
E G L M ! & ' ( ) * + , - 4 5 B C U��WV��\���������� S��
 �����jP�������Y_������jW�������d����$������������
                                                  W���������������XZj���������������P ��
Jason Vas Dias

Jason Vas Dias

2022-06-03 12:14

reporter   ~0000227

Aha, OOPs, I think it was my '-x c++' in CXXFLAGS - sorry!
Jason Vas Dias

Jason Vas Dias

2022-06-03 12:17

reporter   ~0000228

In conclusion, the 'g++32.specs' GCC SPECS file attached above DOES now successfully enable me to build the 'gmp-6.2.1-1.el8.i686.rpm' from the
modified gmp-6.1.0 SRPM which installs into /usr/local/lib64 and /usr/local/include , which do should NOT get used for system builds with the system
gcc 8 or clang 13 compilers .
Louis Abel

Louis Abel

2022-08-25 18:43

administrator   ~0000478

Closing as we do not ship the i686 packages. Please open a new bug report if there any other issues. If you find that these same issues are reproducible on a RHEL system, please report it to bugzilla.redhat.com.

Issue History

Date Modified Username Field Change
2022-06-02 17:58 Jason Vas Dias New Issue
2022-06-02 18:22 Louis Abel Note Added: 0000215
2022-06-02 18:34 Jason Vas Dias Note Added: 0000217
2022-06-02 23:27 Jason Vas Dias Note Added: 0000218
2022-06-03 09:49 Jason Vas Dias Note Added: 0000219
2022-06-03 09:55 Jason Vas Dias Note Added: 0000220
2022-06-03 09:58 Jason Vas Dias Note Added: 0000221
2022-06-03 09:58 Jason Vas Dias File Added: g++32.specs.txt
2022-06-03 09:58 Jason Vas Dias File Added: g++32-orig.specs.txt
2022-06-03 09:59 Jason Vas Dias Note Added: 0000222
2022-06-03 10:02 Jason Vas Dias Note Added: 0000223
2022-06-03 10:04 Jason Vas Dias Note Added: 0000224
2022-06-03 11:59 Jason Vas Dias Note Added: 0000225
2022-06-03 12:12 Jason Vas Dias Note Added: 0000226
2022-06-03 12:14 Jason Vas Dias Note Added: 0000227
2022-06-03 12:17 Jason Vas Dias Note Added: 0000228
2022-08-25 18:43 Louis Abel Assigned To => Louis Abel
2022-08-25 18:43 Louis Abel Status new => closed
2022-08-25 18:43 Louis Abel Resolution open => won't fix
2022-08-25 18:43 Louis Abel Note Added: 0000478