From: Fangrui Song <maskray@google.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
hjl.tools@gmail.com, Peter Zijlstra <peterz@infradead.org>,
x86@kernel.org, Josh Poimboeuf <jpoimboe@redhat.com>,
mbenes@suse.cz, rostedt@goodmis.org,
linux-toolchains@vger.kernel.org
Subject: Re: The trouble with __weak and objtool got worse
Date: Fri, 15 Apr 2022 14:17:40 -0700 [thread overview]
Message-ID: <20220415211740.qju2brynn7uyxdg7@google.com> (raw)
In-Reply-To: <CAKwvOdmNLRSyjAn=gS9mCHot3F5-FTfUb46LyOz7Oav55=H0kQ@mail.gmail.com>
On 2022-04-15, Nick Desaulniers wrote:
>On Fri, Apr 15, 2022 at 1:11 PM Segher Boessenkool
><segher@kernel.crashing.org> wrote:
>>
>> On Fri, Apr 15, 2022 at 11:36:32AM -0700, Nick Desaulniers wrote:
>> > On Fri, Apr 15, 2022 at 11:27 AM Segher Boessenkool
>> > <segher@kernel.crashing.org> wrote:
>> > >
>> > > > Alternatively:
>> > > >
>> > > > https://sourceware.org/pipermail/binutils/2020-December/114671.html
>> > > >
>> > > > seems to suggest: -Wa,--generate-unused-section-symbols=yes, ought to
>> > > > work, except I'm getting:
>> > >
>> > > That email is for a proposed patch. Did anything further ever happen
>> > > with it?
>> >
>> > $ gcc hello.c -Wa,--generate-unused-section-symbols=yes
>> > as: unrecognized option '--generate-unused-section-symbols=yes'
>> > $ gcc hello.c -Wa,-generate-unused-section-symbols=yes
>> > $ gcc --version
>> > gcc (Debian 11.2.0-16) 11.2.0
>> >
>> > Uh, the email says -- prefix, but reality shows a single prefix? What
>> > happened there? Maybe that link is to an earlier version than what
>> > landed?
>>
>> Neither has landed. You get the -g option, which can take options of
>> itself, parsed by the target or file format code. "as -gobbledygook"
>> works fine as well :-)
>
>https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1408485ce69f844dcd7ded093a8
>Looks like it's been in binutils since 2.36 (IIUC the ChangeLog correctly).
(Came to this thread from https://reviews.llvm.org/D123874)
H.J.'s patch discards unused STT_SECTION symbols.
The ability to add back such symbols (--generate-unused-section-symbols={yes|no}) is not in binutils.
Neither 2.36 nor master branch has --generate-unused-section-symbols={yes|no}.
as -generate-unused-section-symbols=yes is just a GNU as quirk that it
interprets nearly all -g* options as -g, which generates .debug_arange
and .debug_info compile units. The feature is very different from
restoring STT_SECTION symbols.
I know little about the kernel requirement but I think it shouldn't be
too difficult to teach a relocatable object file consumer to not assume
existence of STT_SECTION. The converse (add the feature to GNU as and
LLVM integrated assembler) would be much more unideal.
See also
https://sourceware.org/pipermail/binutils/2022-March/119940.html
> This problem was fixed in the kernel (and backported by distros to their
> kernels if binutils was updated); it's fairly simplistic changes.
>
> I don't see the need for returning (optionally) to the old behaviour
> again. I mean, at the time, when 2.36 came out, sure, the patch might
> have made sense, but now?
next prev parent reply other threads:[~2022-04-15 21:17 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-15 11:19 The trouble with __weak and objtool got worse Peter Zijlstra
2022-04-15 14:12 ` Steven Rostedt
2022-04-15 15:31 ` Peter Zijlstra
2022-04-15 15:10 ` Josh Poimboeuf
2022-04-15 15:15 ` Josh Poimboeuf
2022-04-15 15:26 ` Peter Zijlstra
2022-04-15 17:40 ` Nick Desaulniers
2022-04-15 18:21 ` Josh Poimboeuf
2022-04-15 18:23 ` Josh Poimboeuf
2022-04-15 20:36 ` Nick Desaulniers
2022-04-16 10:49 ` Peter Zijlstra
2022-04-16 10:48 ` Peter Zijlstra
2022-04-16 16:07 ` Josh Poimboeuf
2022-04-16 16:32 ` H.J. Lu
2022-04-17 15:44 ` Peter Zijlstra
2022-04-17 15:46 ` Peter Zijlstra
2022-04-15 18:22 ` Segher Boessenkool
2022-04-15 18:36 ` Nick Desaulniers
2022-04-15 20:07 ` Segher Boessenkool
2022-04-15 20:31 ` Nick Desaulniers
2022-04-15 21:17 ` Fangrui Song [this message]
2022-04-15 21:41 ` Segher Boessenkool
2022-04-16 11:09 ` Peter Zijlstra
2022-04-16 10:59 ` Peter Zijlstra
2022-04-16 13:20 ` Segher Boessenkool
2022-04-16 17:59 ` Segher Boessenkool
2022-04-15 21:04 ` H.J. Lu
2022-04-16 11:25 ` Peter Zijlstra
2022-04-16 16:27 ` H.J. Lu
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=20220415211740.qju2brynn7uyxdg7@google.com \
--to=maskray@google.com \
--cc=hjl.tools@gmail.com \
--cc=jpoimboe@redhat.com \
--cc=linux-toolchains@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=segher@kernel.crashing.org \
--cc=x86@kernel.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 NNTP newsgroup(s).