public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/111238] New: libstdc++ tests should use -Wl,-gc-sections in more configurations
@ 2023-08-30 13:54 clyon at gcc dot gnu.org
  2023-08-30 14:38 ` [Bug libstdc++/111238] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: clyon at gcc dot gnu.org @ 2023-08-30 13:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111238
           Summary: libstdc++ tests should use -Wl,-gc-sections in more
                    configurations
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: clyon at gcc dot gnu.org
                CC: jwakely.gcc at gmail dot com
  Target Milestone: ---

As a follow-up to bug #104167, I've looked in more detail after Jonathan's last
comment there:

> Does arm-eabi build libstdc++.a with -ffunction-sections?
> The tests should be built with -Wl,--gc-sections which combined with
> -ffunction-sections should mean that the tests do not pull in symbols
> they don't need.

So on arm-eabi, libstdc++'s configure correctly detects that
-ffunction-sections is supported, and builds with it.

However, when running the testsuite, it lacks -Wl,-gc-sections.
I checked manually that adding this flag makes the link succeed for the
offending testcase I reported in PR #104167.

This happens because we are not in a native mode build, so configure.ac does
not run GLIBCXX_CHECK_LINKER_FEATURES, and even when running the "cross target
environment" part of the configuration, we do not even make use of
GLIBCXX_CROSSCONFIG because I configure with --with-newlib.

That being said, GLIBCXX_CROSSCONFIG makes use of -Wl,--gc-sections only for
*-tpf targets, so even configuring without --with-newlib wouldn't help.

Maybe we could call GLIBCXX_CHECK_LINKER_FEATURES only when not in
canadian-cross mode?

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

* [Bug libstdc++/111238] libstdc++ tests should use -Wl,-gc-sections in more configurations
  2023-08-30 13:54 [Bug libstdc++/111238] New: libstdc++ tests should use -Wl,-gc-sections in more configurations clyon at gcc dot gnu.org
@ 2023-08-30 14:38 ` redi at gcc dot gnu.org
  2023-09-04 20:44 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2023-08-30 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-08-30
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

* [Bug libstdc++/111238] libstdc++ tests should use -Wl,-gc-sections in more configurations
  2023-08-30 13:54 [Bug libstdc++/111238] New: libstdc++ tests should use -Wl,-gc-sections in more configurations clyon at gcc dot gnu.org
  2023-08-30 14:38 ` [Bug libstdc++/111238] " redi at gcc dot gnu.org
@ 2023-09-04 20:44 ` cvs-commit at gcc dot gnu.org
  2023-09-04 20:50 ` clyon at gcc dot gnu.org
  2023-09-06  8:37 ` clyon at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-04 20:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Christophe Lyon <clyon@gcc.gnu.org>:

https://gcc.gnu.org/g:56d0592db19b69e3cc217fabe5c2f8be3a75a8cf

commit r14-3660-g56d0592db19b69e3cc217fabe5c2f8be3a75a8cf
Author: Christophe Lyon <christophe.lyon@linaro.org>
Date:   Thu Aug 31 13:50:16 2023 +0000

    libstdc++: Use GLIBCXX_CHECK_LINKER_FEATURES for cross-builds (PR111238)

    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?

    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.

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

* [Bug libstdc++/111238] libstdc++ tests should use -Wl,-gc-sections in more configurations
  2023-08-30 13:54 [Bug libstdc++/111238] New: libstdc++ tests should use -Wl,-gc-sections in more configurations clyon at gcc dot gnu.org
  2023-08-30 14:38 ` [Bug libstdc++/111238] " redi at gcc dot gnu.org
  2023-09-04 20:44 ` cvs-commit at gcc dot gnu.org
@ 2023-09-04 20:50 ` clyon at gcc dot gnu.org
  2023-09-06  8:37 ` clyon at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: clyon at gcc dot gnu.org @ 2023-09-04 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Christophe Lyon <clyon at gcc dot gnu.org> ---
Oops sorry I pushed an unwanted patch, which I reverted with
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=084a7cf9fb2d9cb98dfbe7d91602c840ec50b002

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

* [Bug libstdc++/111238] libstdc++ tests should use -Wl,-gc-sections in more configurations
  2023-08-30 13:54 [Bug libstdc++/111238] New: libstdc++ tests should use -Wl,-gc-sections in more configurations clyon at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-09-04 20:50 ` clyon at gcc dot gnu.org
@ 2023-09-06  8:37 ` clyon at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: clyon at gcc dot gnu.org @ 2023-09-06  8:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Christophe Lyon <clyon at gcc dot gnu.org> ---
The original problem is fixed by
https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628998.html, and it seems
better not to call GLIBCXX_CHECK_LINKER_FEATURES and silently hide a potential
problem.

Maybe we should actually remove -gc-sections from native builds too, so that
all configurations are consistent?
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/629031.html

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

end of thread, other threads:[~2023-09-06  8:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30 13:54 [Bug libstdc++/111238] New: libstdc++ tests should use -Wl,-gc-sections in more configurations clyon at gcc dot gnu.org
2023-08-30 14:38 ` [Bug libstdc++/111238] " redi at gcc dot gnu.org
2023-09-04 20:44 ` cvs-commit at gcc dot gnu.org
2023-09-04 20:50 ` clyon at gcc dot gnu.org
2023-09-06  8:37 ` clyon 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).