From: Florian Weimer <fweimer@redhat.com>
To: Nick Clifton <nickc@redhat.com>
Cc: binutils@sourceware.org
Subject: Re: Named local symbols in the ELF dynamic symbol table
Date: Fri, 09 Dec 2022 18:34:47 +0100 [thread overview]
Message-ID: <87edt8jxag.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <15cc745d-b635-daab-4a02-918a5ea5d923@redhat.com> (Nick Clifton's message of "Thu, 8 Dec 2022 13:19:41 +0000")
* Nick Clifton:
> Hi Florian,
>
>> Is there a way to get the same effect on other targets?
>
> How are the loaders for other targets linked ? If they include the
> -X or --discard-locals option on the command line, then removing that
> option might achieve the result that you desire.
I'm using:
gcc -nostdlib -nostartfiles -shared -o …/build/elf/ld.so.new \
-Wl,-z,relro -Wl,-z,defs \
…/build/elf/librtld.os -Wl,--version-script=…/build/ld.map \
-Wl,-soname=ld-linux-x86-64.so.2
gcc -v tells me:
/usr/libexec/gcc/x86_64-redhat-linux/11/collect2 \
-plugin /usr/libexec/gcc/x86_64-redhat-linux/11/liblto_plugin.so \
-plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper \
-plugin-opt=-fresolution=/tmp/ccHaMg3U.res --build-id --no-add-needed \
--eh-frame-hdr --hash-style=gnu -m elf_x86_64 -shared \
-o …/build/elf/ld.so.new -L/usr/lib/gcc/x86_64-redhat-linux/11 \
-L/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64 -L/lib/../lib64 \
-L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/11/../../.. \
-z relro -z defs …/build/elf/librtld.os --version-script=…/build/ld.map \
-soname=ld-linux-x86-64.so.2
So it seems that -X or --discard-locals is the default? How do I
override that, preferably for specific symbols only?
>> It would best
>> if I wouldn't have to bloat the entire symbol table for that.
>
> I don't think that you have symbol names without having entries in
> the symbol table. Although as you say, if they are local symbols
> then they will not also take up room in the GNU_HASH table.
Yeah, should have said symbol hash table. I really want them in .dynsym
actually.
Thanks,
Florian
next prev parent reply other threads:[~2022-12-09 17:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 17:11 Florian Weimer
2022-12-08 13:19 ` Nick Clifton
2022-12-09 17:34 ` Florian Weimer [this message]
2022-12-14 15:31 ` Nick Clifton
2022-12-14 20:05 ` Fangrui Song
2022-12-14 21:44 ` H.J. Lu
2022-12-14 21:53 ` Florian Weimer
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=87edt8jxag.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=binutils@sourceware.org \
--cc=nickc@redhat.com \
/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).