[PATCH] Teach LTOModule to emit linker flags for dllexported symbols, plus interface cleanup.
Peter Collingbourne
peter at pcc.me.uk
Thu Jun 18 13:50:56 PDT 2015
Hi rnk, ygao,
This change unifies how LTOModule and the backend obtain linker flags
for globals: via a new TargetLoweringObjectFile member function named
emitLinkerFlagsForGlobal. A new function LTOModule::getLinkerOpts() returns
the list of linker flags as a single concatenated string.
This change affects the C libLTO API: the function lto_module_get_*deplibs now
exposes an empty list, and lto_module_get_*linkeropts exposes a single element
which combines the contents of all observed flags. libLTO should never have
tried to parse the linker flags; it is the linker's job to do so. Because
linkers will need to be able to parse flags in regular object files, it
makes little sense for libLTO to have a redundant mechanism for doing so.
The new API is compatible with the old one. It is valid for a user to specify
multiple linker flags in a single pragma directive like this:
#pragma comment(linker, "/defaultlib:foo /defaultlib:bar")
The previous implementation would not have exposed
either flag via lto_module_get_*deplibs (as the test in
TargetLoweringObjectFileCOFF::getDepLibFromLinkerOpt was case sensitive)
and would have exposed "/defaultlib:foo /defaultlib:bar" as a single flag via
lto_module_get_*linkeropts. This may have been a bug in the implementation,
but it does give us a chance to fix the interface.
http://reviews.llvm.org/D10548
Files:
include/llvm-c/lto.h
include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
include/llvm/LTO/LTOModule.h
include/llvm/Target/TargetLoweringObjectFile.h
lib/CodeGen/TargetLoweringObjectFileImpl.cpp
lib/LTO/LTOModule.cpp
lib/Target/X86/X86AsmPrinter.cpp
lib/Target/X86/X86AsmPrinter.h
test/CodeGen/X86/dllexport-x86_64.ll
test/CodeGen/X86/dllexport.ll
tools/lto/lto.cpp
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10548.27960.patch
Type: text/x-patch
Size: 18036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150618/0e4d053b/attachment.bin>
More information about the llvm-commits
mailing list