[LLVMbugs] [Bug 19901] New: The plugin can drop a symbol gold has asked for
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri May 30 13:28:03 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19901
Bug ID: 19901
Summary: The plugin can drop a symbol gold has asked for
Product: tools
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: gold-plugin
Assignee: unassignedbugs at nondot.org
Reporter: rafael.espindola at gmail.com
CC: llvmbugs at cs.uiuc.edu, nlewycky at google.com
Classification: Unclassified
$ cat test.ll
define linkonce_odr void @f() {
ret void
}
$ cat test2.ll
define i32 @main() {
call void @f()
ret i32 0
}
define linkonce_odr void @f() {
ret void
}
$ llc test2.ll -o test2.o -filetype=obj
$ llvm-as test.ll -o test.o
$ clang -flto test.o test2.o -o test
$ ./test
Segmentation fault
What is going on is:
gold decides to keep the 'f' defined in the IR file and tells the plugin that.
The plugin calls lto_codegen_add_must_preserve_symbol, but that does nothing
since the symbol is linkonce_odr and the IR linker will not copy it in if it is
not needed (from its narrow point of view).
The fix for the the gold plugin is clear if a bit laborious: apply the
restrictions to the unmerged module. If we are told to keep a symbol, change
the linkage to make sure we do. If we are told to drop a symbol, drop it before
even passing it down to the IR linker.
I will test this on OS X with ld64 in a sec.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140530/3e23e977/attachment.html>
More information about the llvm-bugs
mailing list