[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/15323] New: Unable to redefine weak function in -flto incrementa
From: |
josh.m.conner at gmail dot com |
Subject: |
[Bug ld/15323] New: Unable to redefine weak function in -flto incrementally-linked executable |
Date: |
Fri, 29 Mar 2013 21:29:28 +0000 |
http://sourceware.org/bugzilla/show_bug.cgi?id=15323
Bug #: 15323
Summary: Unable to redefine weak function in -flto
incrementally-linked executable
Product: binutils
Version: 2.23
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: address@hidden
ReportedBy: address@hidden
Classification: Unclassified
If I have a weak function defined in an executable created with -flto -r, when
I try to redefine the function by re-linking with an object file containing a
non-weak definition of the same function, I get an error:
`foobar' referenced in section `.text.startup' of test-intermediate: defined in
discarded section `.text' of test.o (symbol from plugin)
collect2: error: ld returned 1 exit status
Here are some steps to reproduce, where gcc is using ld with the linker plugin
for lto:
$ cat test-weak.c
volatile int x;
__attribute__((weak))
void foobar (void) { x++; }
int main (void)
{
foobar ();
return 0;
}
$ cat test.c
extern volatile int x;
void foobar (void) { x--; }
$ gcc -flto -g -O2 -c -o test-weak.o test-weak.c
$ gcc -flto -g -O2 -c -o test.o test.c
$ gcc -flto -g -O2 -r -o test-intermediate test-weak.o -nostdlib
-nostartfiles
$ gcc -flto -g -O2 -o test test-intermediate test.o
`foobar' referenced in section `.text.startup' of test-intermediate: defined in
discarded section `.text' of test.o (symbol from plugin)
collect2: error: ld returned 1 exit status
Let me know if you need an example that is assembly-only, or if you need me to
verify with top-of-tree.
(Note that I can work around the error with -fno-use-linker-plugin, but I want
to use the linker plugin for whole program optimization purposes).
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
- [Bug ld/15323] New: Unable to redefine weak function in -flto incrementally-linked executable,
josh.m.conner at gmail dot com <=