public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "matz at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug driver/99896] g++ drops -lc
Date: Tue, 06 Apr 2021 14:16:55 +0000 [thread overview]
Message-ID: <bug-99896-4-j2OuLDxq42@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99896-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99896
Michael Matz <matz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |matz at gcc dot gnu.org
--- Comment #7 from Michael Matz <matz at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to Tom de Vries from comment #0)
> > With g++, we have instead:
> > ...
> > collect2 ... main.o foo.o -lpcre2-posix ...
> > ...
>
> It isn't dropped, it's moved to the end:
>
> main.o foo.o -lpcre2-posix -lstdc++ -lm -lc -lgcc_s -lgcc -lc -lgcc_s -lgcc
>
> If you need it before foo.o then -Wl,-lc seems like the right workaround for
> me.
Workaround is the correct term here. The correct thing would be for g++ to not
reorder -l arguments. The similarity to -I is superficial: duplicated -l
arguments have meaning (with static archives for instance) and their position
in relation to object and source files matters. g++ can validly tack on
additional -l arguments to the end, and arguably also replace a lone -lc
argument that was originally at the end of the command line or implicit (e.g.
to inject its unwinder), but it shouldn't otherwise reorder such arguments.
I will of course agree that the issue that the added -lc "solves" is actually
a bug in the testcase (and gdb). But that should be immaterial here. At the
very least gcc and g++ should behave the same in this respect.
prev parent reply other threads:[~2021-04-06 14:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-03 13:04 [Bug driver/99896] New: " vries at gcc dot gnu.org
2021-04-03 14:32 ` [Bug driver/99896] " redi at gcc dot gnu.org
2021-04-03 16:57 ` vries at gcc dot gnu.org
2021-04-03 18:01 ` schwab@linux-m68k.org
2021-04-03 20:30 ` redi at gcc dot gnu.org
2021-04-03 22:45 ` schwab@linux-m68k.org
2021-04-04 2:02 ` vries at gcc dot gnu.org
2021-04-06 14:16 ` matz at gcc dot gnu.org [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-99896-4-j2OuLDxq42@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).