[Bug lto/88643] New: -Wl,--wrap not supported with LTO
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 31 12:19:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88643
Bug ID: 88643
Summary: -Wl,--wrap not supported with LTO
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
Target Milestone: ---
Seen in cmocka package:
$ cat foo.h
int cook(void);
$ cat foo.c
#include "foo.h"
int __wrap_cook(void)
{
return 0;
}
$ cat bar.c
int cook(void)
{
return -1;
}
$ cat main.c
#include "foo.h"
int main()
{
if (cook () == -1)
__builtin_abort ();
return 0;
}
$ gcc main.c foo.c bar.c -Wl,--wrap=cook && ./a.out
(ok)
$ gcc main.c foo.c bar.c -Wl,--wrap=cook -flto && ./a.out
Aborted (core dumped)
$ cat main.res
3
main.o 2
198 afba4c81ec45b173 PREVAILING_DEF main
215 afba4c81ec45b173 RESOLVED_IR cook
foo.o 1
197 34da4dbae42a1068 PREVAILING_DEF_IRONLY __wrap_cook
bar.o 1
197 d2fb0e1d62586272 PREVAILING_DEF_IRONLY cook
I'm not sure there's an API for linker plugin to resolve a symbol with a
deferent one. Honza?
More information about the Gcc-bugs
mailing list