[PATCH] libstdc++: Use GLIBCXX_CHECK_LINKER_FEATURES for cross-builds (PR111238)
Hans-Peter Nilsson
hp@axis.com
Thu Aug 31 17:05:19 GMT 2023
> Date: Thu, 31 Aug 2023 17:25:45 +0200
> From: Christophe Lyon via Gcc-patches <gcc-patches@gcc.gnu.org>
> As discussed in PR104167 (comments #8 and below), and PR111238, using
> -Wl,-gc-sections in the libstdc++ testsuite for arm-eabi
> (cross-toolchain) avoids link failures for a few tests:
>
> 27_io/filesystem/path/108636.cc
> std/time/clock/gps/1.cc
> std/time/clock/gps/io.cc
> std/time/clock/tai/1.cc
> std/time/clock/tai/io.cc
> std/time/clock/utc/1.cc
> std/time/clock/utc/io.cc
> std/time/clock/utc/leap_second_info.cc
> std/time/exceptions.cc
> std/time/format.cc
> std/time/time_zone/get_info_local.cc
> std/time/time_zone/get_info_sys.cc
> std/time/tzdb/1.cc
> std/time/tzdb/leap_seconds.cc
> std/time/tzdb_list/1.cc
> std/time/zoned_time/1.cc
> std/time/zoned_time/custom.cc
> std/time/zoned_time/io.cc
> std/time/zoned_traits.cc
>
> This patch achieves this by calling GLIBCXX_CHECK_LINKER_FEATURES in
> cross-build cases, like we already do for native builds. We keep not
> doing so in Canadian-cross builds.
>
> However, this would hide the fact that libstdc++ somehow forces the
> user to use -Wl,-gc-sections to avoid undefined references to chdir,
> mkdir, chmod, pathconf, ... so maybe it's better to keep the status
> quo and not apply this patch?
Datapoint: no failures for cris-elf in the listed tests -
but it instead passes --gc-sections if -O2 or -O3 is seen
for linking; see cris/cris.h. It's been like that forever,
modulo a patch in 2002 not passing it if "-r" is seen.
Incidentally, I've been sort-of investigating a recent-ish
commit to newlib (8/8) that added a stub for getpriority,
which was apparently added due to testsuite breakage for
libstdc++ and arm-eabi, but that instead broke testsuite
results for *other* targets, as warning at link-time. Film
at 11.
> 2023-08-31 Christophe Lyon <christophe.lyon@linaro.org>
>
> libstdc++-v3/ChangeLog:
>
> PR libstdc++/111238
> * configure: Regenerate.
> * configure.ac: Call GLIBCXX_CHECK_LINKER_FEATURES in cross,
> non-Canadian builds.
On this actual patch, I can't say yay or nay though (but
leaning towards yay), but I'll test for cris-elf. Would you
mind holding off committing for a day or two?
brgds, H-P
More information about the Libstdc++
mailing list