https://llvm.org/bugs/show_bug.cgi?id=26674
Bug ID: 26674 Summary: --start-lib/--end-lib broken with LTO Product: libraries Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: Linker Assignee: unassignedb...@nondot.org Reporter: eugeni.stepa...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified $ cat bin.cc int main() {} $ cat 1.cc __attribute__((constructor(0))) void ctor() {} $ ./bin/clang++ -flto bin.cc -c $ ./bin/clang++ -flto 1.cc -c $ ./bin/clang++ -fuse-ld=gold -flto bin.o -Wl,--start-lib 1.o -Wl,--end-lib /tmp/lto-llvm-2af7ce.o(.init_array.0+0x0): error: undefined reference to 'ctor()' clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation) With -Wl,-plugin-opt,save-temps the merged IR (before link time optimizations) looks like this: [...] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @_Z4ctorv, i8* null }] ; Function Attrs: norecurse nounwind uwtable define i32 @main() #0 { entry: ret i32 0 } ; Function Attrs: nounwind uwtable declare void @_Z4ctorv() #1 [...] $ /usr/bin/ld.gold --version GNU gold (GNU Binutils for Ubuntu 2.24) 1.11 -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs