public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/106501] New: libstdc++ is built without -fPIC despite --with-pic
@ 2022-08-01 22:22 skunk at iskunk dot org
  2022-08-01 22:27 ` [Bug libstdc++/106501] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: skunk at iskunk dot org @ 2022-08-01 22:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106501
           Summary: libstdc++ is built without -fPIC despite --with-pic
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: skunk at iskunk dot org
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu
             Build: x86_64-pc-linux-gnu

I bootstrapped GCC 12.1.0 with the following options:

    --disable-shared
    --disable-nls
    --enable-version-specific-runtime-libs
    --with-pic
    --disable-multilib
    --with-arch=opteron
    --disable-libsanitizer
    --disable-libcc1
    --enable-languages=c,c++,lto

Notable is the combination of "--disable-shared --with-pic", with the intention
of having all the GCC support libraries be statically linkable when building
executables, shared libraries, etc.

Once the bootstrap was complete, I used the new GCC to build a current version
of GDB. That build failed with

  CXXLD  libinproctrace.so
/usr/bin/ld:
/opt/sfw/bin/../lib/gcc/x86_64-pc-linux-gnu/12.1.0/libstdc++.a(class_type_info.o):
relocation R_X86_64_32S against `_ZTVN10__cxxabiv117__class_type_infoE' can not
be used when making a shared object; recompile with -fPIC
/opt/sfw/bin/../lib/gcc/x86_64-pc-linux-gnu/12.1.0/libstdc++.a: could not read
symbols: Bad value
collect2: error: ld returned 1 exit status
gmake[2]: *** [Makefile:383: libinproctrace.so] Error 1
gmake[2]: Leaving directory '/tmp/gdb-12.1-build/gdbserver'
gmake[1]: *** [Makefile:11743: all-gdbserver] Error 2
gmake[1]: Leaving directory '/tmp/gdb-12.1-build'
gmake: *** [Makefile:1001: all] Error 2


I checked the build log for GCC. None of the compile lines for
class_type_info.o include the -fPIC option (i.e. "fgrep class_type_info.o
gcc12-build-log.txt | grep -c PIC" yields 0).

The --with-pic option should cause all libraries to be built with -fPIC, even
when they are built as static archives. It is possible that libstdc++ is not
the only library that was built incorrectly; it is only the one I noticed.

Related: bug #66955, bug #67128

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libstdc++/106501] libstdc++ is built without -fPIC despite --with-pic
  2022-08-01 22:22 [Bug libstdc++/106501] New: libstdc++ is built without -fPIC despite --with-pic skunk at iskunk dot org
@ 2022-08-01 22:27 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-01 22:27 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Duplicate of bug 58638.

*** This bug has been marked as a duplicate of bug 58638 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-01 22:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 22:22 [Bug libstdc++/106501] New: libstdc++ is built without -fPIC despite --with-pic skunk at iskunk dot org
2022-08-01 22:27 ` [Bug libstdc++/106501] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).