[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/25389] New: - -Wl,--wrap -fuse-ld=bfd not supported with LTO
From: |
cuilili8868 at gmail dot com |
Subject: |
[Bug ld/25389] New: - -Wl,--wrap -fuse-ld=bfd not supported with LTO |
Date: |
Wed, 15 Jan 2020 08:23:00 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=25389
Bug ID: 25389
Summary: - -Wl,--wrap -fuse-ld=bfd not supported with LTO
Product: binutils
Version: 2.33
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: cuilili8868 at gmail dot com
Target Milestone: ---
$ cat a.c
int w = 100;
int z = 78;
extern int foo()
{
return w + z;
}
extern int main()
{
return foo() + foo() * foo();
}
$ cat b.c
int x = 76;
int y = 87;
#define likely(z) __builtin_expect(!!(z), 1)
extern int __wrap_foo()
{
if (likely(x)) {
return __real_foo();
}
int i,s;
for (i = 0; i < 10000; i++)
s = s + x * y - i;
}
$gcc -flto -fuse-ld=bfd -Wl,--wrap=foo a.c b.c
/tmp/ccPX4lh2.ltrans0.ltrans.o: in function `__wrap_foo':
<artificial>:(.text+0x6a): undefined reference to `foo'
gcc version: 7.4.0 or gcc trunk
binutils version: 2.33 or binutils trunk
I tried different configurations, this works
gcc -flto -fuse-ld=gold -Wl,--wrap=read -O3 a.c b.c
gcc -flto -fuse-ld=gold -Wl,--wrap=read -O2 a.c b.c
gcc -flto -fuse-ld=gold -Wl,--wrap=read -O1 a.c b.c
This does not work:
gcc -flto -fuse-ld=gold -Wl,--wrap=read -O0 a.c b.c
gcc -flto -fuse-ld=bfd -Wl,--wrap=read -O3 a.c b.c
gcc -flto -fuse-ld=bfd -Wl,--wrap=read -O2 a.c b.c
gcc -flto -fuse-ld=bfd -Wl,--wrap=read -O1 a.c b.c
gcc -flto -fuse-ld=bfd -Wl,--wrap=read -O0 a.c b.c
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/25389] New: - -Wl,--wrap -fuse-ld=bfd not supported with LTO,
cuilili8868 at gmail dot com <=