From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
To: "binutils@sourceware.org" <binutils@sourceware.org>
Subject: About gprofng/30006 - Failure to build binutils-2.40 gprofng using gold
Date: Mon, 6 Feb 2023 18:47:33 -0800 [thread overview]
Message-ID: <6cd03b30-a40b-5e29-094a-6a4529852633@oracle.com> (raw)
Hello Linux Experts,
The original problem is here:
30006 - Failure to build binutils-2.40 gprofng using gold
https://sourceware.org/bugzilla/show_bug.cgi?id=30006
I prepared a small test that demonstrates the problem:
% cat test.c
void *dlopen (const char *pathname, int mode)
{ return (void *) 0; }
__attribute__ ((__symver__ ("dlopen@GLIBC_2.1")))
void *__collector_dlopen_2_1 (const char *pathname, int mode)
{ return (void *) 0; }
__attribute__ ((__symver__ ("dlopen@GLIBC_2.0")))
void *__collector_dlopen_2_0 (const char *pathname, int mode)
{ return (void *) 0; }
int main()
{ return 0; }
% cat map.txt
GLIBC_2.0 {
global:
dlopen;
};
GLIBC_2.1 {
global:
dlopen;
};
There are no problems with -fuse-ld=bfd:
% /opt/rh/gcc-toolset-10/root/bin/gcc -m32 test.c -Wl,--version-script
-Wl,map.txt -fuse-ld=bfd
The output of `nm` shows exactly what I expected:
% nm a.out | grep dlopen
08049191 T __collector_dlopen_2_0
08049187 T __collector_dlopen_2_1
0804917d t dlopen
08049191 t dlopen@GLIBC_2.0
08049187 t dlopen@GLIBC_2.1
But with -fuse-ld=gold:
% /opt/rh/gcc-toolset-10/root/bin/gcc -m32 test.c -Wl,--version-script
-Wl,map.txt -fuse-ld=gold
/bin/ld.gold: warning: /tmp/cc6YCOol.o: unknown program property type
0xc0010001 in .note.gnu.property section
/bin/ld.gold: warning: using 'GLIBC_2.0' as version for 'dlopen' which
is also named in version 'GLIBC_2.1' in script
/bin/ld.gold: error: /tmp/cc6YCOol.o: multiple definition of 'dlopen'
/bin/ld.gold: /tmp/cc6YCOol.o: previous definition here
collect2: error: ld returned 1 exit status
My questions:
Is my test correct ?
if not:
we need to interpose the dlopen functions from libdl.so.
How can I do it correctly ?
If yes:
Is this a known compiler bug in gold ? If not, do I need to create one ?
Is there a simple workaround ?
Thank you,
-Vladimir
next reply other threads:[~2023-02-07 2:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 2:47 Vladimir Mezentsev [this message]
2023-02-08 23:53 ` Cary Coutant
2023-02-10 8:19 ` Vladimir Mezentsev
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=6cd03b30-a40b-5e29-094a-6a4529852633@oracle.com \
--to=vladimir.mezentsev@oracle.com \
--cc=binutils@sourceware.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).