https://sourceware.org/bugzilla/show_bug.cgi?id=24415
Bug ID: 24415 Summary: - -Wl,--wrap= incompatible with -flto Product: binutils Version: 2.33 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: gold Assignee: ccoutant at gmail dot com Reporter: dilyan.palauzov at aegee dot org CC: ian at airs dot com Target Milestone: --- This is t.c: --------------- #include <stdio.h> #include <unistd.h> ssize_t __wrap_read(int fd, void *buffer, size_t count) { printf("%s\n", (char*)buffer); return fd + count; } int main() { int i = read(1, "abc", 5); printf("%i\n", i); } --------------- I have gcc 8.3.1 20190331, clang 8.0.0, lld 8.0.0, ld.bfd 2.32.51.20190401 with the patch from https://sourceware.org/ml/binutils/2019-04/msg00011.html, and ld.gold (GNU Binutils 2.32.51.20190319) 1.16. This works (compiles and links): clang t.c -Wl,--wrap=read -O3 -fuse-ld=lld -flto clang t.c -Wl,--wrap=read -O2 -fuse-ld=lld -flto clang t.c -Wl,--wrap=read -O1 -fuse-ld=lld -flto clang t.c -Wl,--wrap=read -O1 -fuse-ld=bfd -flto clang t.c -Wl,--wrap=read -O2 -fuse-ld=bfd -flto clang t.c -Wl,--wrap=read -O3 -fuse-ld=bfd -flto clang t.c -Wl,--wrap=read -O3 -fuse-ld=gold -flto clang t.c -Wl,--wrap=read -O2 -fuse-ld=gold -flto clang t.c -Wl,--wrap=read -O1 -fuse-ld=gold -flto gcc t.c -Wl,--wrap=read -O3 -fuse-ld=bfd -flto gcc t.c -Wl,--wrap=read -O2 -fuse-ld=bfd -flto gcc t.c -Wl,--wrap=read -O1 -fuse-ld=bfd -flto This does not work (does not link): gcc t.c -Wl,--wrap=read -O1 -fuse-ld=gold -flto gcc t.c -Wl,--wrap=read -O2 -fuse-ld=gold -flto gcc t.c -Wl,--wrap=read -O3 -fuse-ld=gold -flto Bug for ld.bfd: https://sourceware.org/bugzilla/show_bug.cgi?id=24406 Bug for GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88643 (origin) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89930 (duplicate) -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils