Opened 7 months ago

Closed 7 months ago

#15090 closed bug (invalid)

Some linker situations able to crash a simple C++ program

Reported by: jpcima Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: - General Version: R1/Development
Keywords: gcc c++ linker Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All


On attempt to compile a simple C++ hello world with iostream, one can cause a mix of c++ libraries which crashes before reaching main. It's based on the situation of a build using hpkg libraries and pkg-config.


This works: g++ -std=c++11 -o hello && ./hello

But this crashes: g++ -std=c++11 -o hello pkg-config sdl2 libuv uchardet --libs && ./hello

The trouble makers are -L flags expanded by pkg-config, which add a path containing a libstdc++.a static library.

The two tests show different readelf -d hello output. The working case indicated a dynamic link with, the crashing case does not.


Haiku shredder 1 hrev53167 May 26 2019 19:04:45 x86_64 x86_64 Haiku gcc version 8.3.0 (2019_05_24)

libsdl2_devel-2.0.9-1 libsdl2-2.0.9-1 libuv_debuginfo-1.29.1-1 libuv_devel-1.29.1-1 libuv-1.29.1-1 uchardet_devel-0.0.6-2 uchardet-0.0.6-2 libiconv_devel-1.15-4 libiconv-1.15-4

Additional notes Report of program hit by linking bug

Change History (2)

comment:1 by waddlesplash, 7 months ago

I don't think we should ship a static libstdc++ at all, probably (or at least not in a default search path.)

comment:2 by waddlesplash, 7 months ago

Resolution: invalid
Status: newclosed

This seems to just be a bug in our GCC or libstdc++ ports, so please open a ticket at instead of here.

Note: See TracTickets for help on using tickets.