[Bug target/89096] [7/8/9/10 regression] AIX 7 linker rejects _<filename>.ro_ sections by default

andrew at ishiboo dot com gcc-bugzilla@gcc.gnu.org
Fri Jul 12 23:06:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89096

--- Comment #14 from Andrew Paprocki <andrew at ishiboo dot com> ---
I can reproduce this error with a much simpler project, pcre, that uses
autotools and libtool.

Using pcre 8.42 from https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz

$ mkdir build
$ cd build
$ CC=gcc-6 CXX=g++-6 OBJECT_MODE=32 CFLAGS="-maix32 -O" CXXFLAGS="-maix32 -O"
../configure --enable-unicode-properties --enable-pcre16 --enable-pcre32
--enable-jit
$ OBJECT_MODE=32 make V=1
...
g++-6 -DHAVE_CONFIG_H -I. -I..     -maix32 -O -MT
pcrecpp_unittest-pcrecpp_unittest.o -MD -MP -MF
.deps/pcrecpp_unittest-pcrecpp_unittest.Tpo -c -o
pcrecpp_unittest-pcrecpp_unittest.o `test -f 'pcrecpp_unittest.cc' || echo
'../'`pcrecpp_unittest.cc
mv -f .deps/pcrecpp_unittest-pcrecpp_unittest.Tpo
.deps/pcrecpp_unittest-pcrecpp_unittest.Po
/bin/sh ./libtool  --tag=CXX   --mode=link g++-6  -maix32 -O   -o
pcrecpp_unittest pcrecpp_unittest-pcrecpp_unittest.o libpcrecpp.la  -lpthreads
libtool: link: g++-6 -maix32 -O -o .libs/pcrecpp_unittest
pcrecpp_unittest-pcrecpp_unittest.o  -L/tmp/pcre/build/.libs -L./.libs
-lpcrecpp -lpcre -L/path/to/gcc/lib -lstdc++ -lm -lpthreads
-Wl,-blibpath:/usr/local/lib:/path/to/gcc/lib:/path/to/gcc/lib/.:/usr/lib:/lib
ld: 0711-308 SEVERE ERROR: Object pcrecpp_unittest-pcrecpp_unittest.o, csect
<_pcrecppunittest.ro_>
        The csect is part of the .text section.
collect2: error: ld returned 12 exit status
Makefile:1518: recipe for target 'pcrecpp_unittest' failed
make[1]: *** [pcrecpp_unittest] Error 1

I've narrowed this down to the usage of the -bsvr4 linker flag, which we use
because we depend on passing multiple -R parameters and the linker behavior
described in the man page:

       -R Path
            ...                 Multiple instances of this option are
            concatenated together with each Path separated by a colon.

If -bsvr4 is placed on the collect2 command line (obtained from -v output of
the link), the link fails with the output above. I know in the past flag
ordering has mattered, and in this case it fails in the same manner when it is
both the first flag and last flag on the command line. This fails without any
usage of -bexpall and -brtl.


More information about the Gcc-bugs mailing list