public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109815] New: AIX: Combining -static-libstdc++ and -pthread causes a TLS-related link error
@ 2023-05-11 15:38 cameron.heide at betasystems dot com
  2023-05-11 15:42 ` [Bug target/109815] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: cameron.heide at betasystems dot com @ 2023-05-11 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109815
           Summary: AIX: Combining -static-libstdc++ and -pthread causes a
                    TLS-related link error
           Product: gcc
           Version: 12.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cameron.heide at betasystems dot com
  Target Milestone: ---

With GCC 12.3 on AIX 7.1, trying to link even a trivial program with both the
'-static-libstdc++' and '-pthread' flags causes a link error:

test.cpp:
    int main() { return 0; }

-bash-5.1$ g++12 -static-libstdc++ -pthread -o test test.cpp
ld: 0711-550 SEVERE ERROR: Object
/IMPORT/home/zNTMAKE/betadev/arch/powerpc-aix7.1/gcc12.3/bin/../lib/gcc/powerpc-ibm-aix7.1.5.0/12.3.0/../../../pthread/libstdc++.a[libstdc++.so.6]
cannot be processed.
        RLD at address 0x2b093 for section 7 (.dwinfo) references a
thread-local
        variable, but a TLS-related reference type was not used.
collect2: error: ld returned 12 exit status

Either flag by itself works; it is just the combination of the two that fails.
This combination also worked with GCC 11.3 and only started failing with GCC
12, with the same GCC configuration flags. (I haven't had a chance to try GCC
13 yet.)

The GCC configuration flags are pretty basic:

-bash-5.1$ gcc12 -v
Using built-in specs.
COLLECT_GCC=gcc12
COLLECT_LTO_WRAPPER=/IMPORT/home/zNTMAKE/betadev/arch/powerpc-aix7.1/gcc12.3/bin/../libexec/gcc/powerpc-ibm-aix7.1.5.0/12.3.0/lto-wrapper
Target: powerpc-ibm-aix7.1.5.0
Configured with: ../gcc-12.3.0/configure
--prefix=/home/zNTMAKE/betadev/arch/powerpc-aix7.1/gcc12.3
--with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++
--disable-nls --enable-threads --enable-bootstrap
--with-gmp=/home/zNTMAKE/betadev/arch/powerpc-aix7.1/gcc-libs
--with-mpfr=/home/zNTMAKE/betadev/arch/powerpc-aix7.1/gcc-libs
--with-mpc=/home/zNTMAKE/betadev/arch/powerpc-aix7.1/gcc-libs
--with-isl=/home/zNTMAKE/betadev/arch/powerpc-aix7.1/gcc-libs
Thread model: aix
Supported LTO compression algorithms: zlib
gcc version 12.3.0 (GCC)

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

* [Bug target/109815] AIX: Combining -static-libstdc++ and -pthread causes a TLS-related link error
  2023-05-11 15:38 [Bug c++/109815] New: AIX: Combining -static-libstdc++ and -pthread causes a TLS-related link error cameron.heide at betasystems dot com
@ 2023-05-11 15:42 ` pinskia at gcc dot gnu.org
  2023-05-29 20:44 ` John.Parke at alebra dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-11 15:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Seems like the debug information for TLS variables are not being written out
correctly and that is causing the link to fail.
I think GCC 12 moved to dwarf2 debug information for AIX which is why it shows
up in GCC 12+ only.

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

* [Bug target/109815] AIX: Combining -static-libstdc++ and -pthread causes a TLS-related link error
  2023-05-11 15:38 [Bug c++/109815] New: AIX: Combining -static-libstdc++ and -pthread causes a TLS-related link error cameron.heide at betasystems dot com
  2023-05-11 15:42 ` [Bug target/109815] " pinskia at gcc dot gnu.org
@ 2023-05-29 20:44 ` John.Parke at alebra dot com
  2023-08-15 14:06 ` cameron.heide at betasystems dot com
  2023-08-15 21:09 ` John.Parke at alebra dot com
  3 siblings, 0 replies; 5+ messages in thread
From: John.Parke at alebra dot com @ 2023-05-29 20:44 UTC (permalink / raw)
  To: gcc-bugs

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

John Parke <John.Parke at alebra dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |John.Parke at alebra dot com

--- Comment #2 from John Parke <John.Parke at alebra dot com> ---
I can confirm that this is also a problem for 13.1.0 on AIX 7.1.4.33 TL04:


FILELIST: Number of previously inserted files processed: 38
(ld): resolve
ld: 0711-550 SEVERE ERROR: Object
/opt/freeware/gcc-13.1.0/lib/gcc/powerpc-ibm-aix7.1.4.0/13.1.0/pthread/libstdc++.a[libstdc++.so.6]
cannot be processed.
        RLD at address 0x28cfd for section 7 (.dwinfo) references a
thread-local
        variable, but a TLS-related reference type was not used.
RESOLVE: 48444 of 249782 symbols were kept.
RESOLVE: The return code is 12.
collect2: error: ld returned 12 exit status


Built with:
../gcc-13.1.0/configure --prefix=/opt/freeware/gcc-13.1.0 --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --enable-languages=c,c++,lto
--enable-version-specific-runtime-libs --disable-nls --with-cloog=no
--with-ppl=no --disable-libstdcxx-pch --enable-__cxa_atexit --disable-werror
--disable-rpath --enable-threads --enable-shared --enable-static
--enable-threads=aix --enable-libstdcxx-threads --with-cpu=default32 --with-pic
--with-static-standard-libraries --with-aix-soname=both --disable-libsanitizer
--disable-bootstrap --enable-libstdcxx-filesystem-ts --disable-libgomp

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

* [Bug target/109815] AIX: Combining -static-libstdc++ and -pthread causes a TLS-related link error
  2023-05-11 15:38 [Bug c++/109815] New: AIX: Combining -static-libstdc++ and -pthread causes a TLS-related link error cameron.heide at betasystems dot com
  2023-05-11 15:42 ` [Bug target/109815] " pinskia at gcc dot gnu.org
  2023-05-29 20:44 ` John.Parke at alebra dot com
@ 2023-08-15 14:06 ` cameron.heide at betasystems dot com
  2023-08-15 21:09 ` John.Parke at alebra dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cameron.heide at betasystems dot com @ 2023-08-15 14:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from C. Heide <cameron.heide at betasystems dot com> ---
I finally got access to an AIX 7.2 system and the problem does not occur there
with GCC 12.3, so it seems to be something specific to DWARF only being
partially supported in AIX 7.1.

The installation instructions do note that AIX 7.1 TL03 SP7 minimum is needed.
My 7.1 system is TL05, but maybe a certain minimum 'SPx' version is needed
there too?

(Probably not a big deal now that 7.1 is out of support and 7.2+ work
anyway...)

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

* [Bug target/109815] AIX: Combining -static-libstdc++ and -pthread causes a TLS-related link error
  2023-05-11 15:38 [Bug c++/109815] New: AIX: Combining -static-libstdc++ and -pthread causes a TLS-related link error cameron.heide at betasystems dot com
                   ` (2 preceding siblings ...)
  2023-08-15 14:06 ` cameron.heide at betasystems dot com
@ 2023-08-15 21:09 ` John.Parke at alebra dot com
  3 siblings, 0 replies; 5+ messages in thread
From: John.Parke at alebra dot com @ 2023-08-15 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from John Parke <John.Parke at alebra dot com> ---
Thanks for taking a look at this.

My AIX system is 7.1 TL 04 SP 05 (2017/20).

We just dropped support for 6, but still have customers on 7.1.

I'll have to see about updating this system to see if that works.

As far as I am concerned you have addressed this issue.

Best regards,

John

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

end of thread, other threads:[~2023-08-15 21:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-11 15:38 [Bug c++/109815] New: AIX: Combining -static-libstdc++ and -pthread causes a TLS-related link error cameron.heide at betasystems dot com
2023-05-11 15:42 ` [Bug target/109815] " pinskia at gcc dot gnu.org
2023-05-29 20:44 ` John.Parke at alebra dot com
2023-08-15 14:06 ` cameron.heide at betasystems dot com
2023-08-15 21:09 ` John.Parke at alebra dot com

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).