summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm-c
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-06-29 22:04:09 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-06-29 22:04:09 +0000
commitaef3659e1888753ffe03510c513e1a2d9101a795 (patch)
tree90628139a0ed05a1976cc268cde21abd210acfc0 /llvm/include/llvm-c
parent3c7828e36ebc615904627561eec6761cca2cbab2 (diff)
downloadbcm5719-llvm-aef3659e1888753ffe03510c513e1a2d9101a795.tar.gz
bcm5719-llvm-aef3659e1888753ffe03510c513e1a2d9101a795.zip
Teach LTOModule to emit linker flags for dllexported symbols, plus interface cleanup.
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. Differential Revision: http://reviews.llvm.org/D10548 llvm-svn: 241010
Diffstat (limited to 'llvm/include/llvm-c')
-rw-r--r--llvm/include/llvm-c/lto.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm-c/lto.h b/llvm/include/llvm-c/lto.h
index 9f37dd71e31..0ccb0e9a584 100644
--- a/llvm/include/llvm-c/lto.h
+++ b/llvm/include/llvm-c/lto.h
@@ -282,6 +282,8 @@ lto_module_get_symbol_attribute(lto_module_t mod, unsigned int index);
/**
* Returns the number of dependent libraries in the object module.
*
+ * Deprecated. Now returns an empty list.
+ *
* \since LTO_API_VERSION=8
*/
extern unsigned int
@@ -291,6 +293,8 @@ lto_module_get_num_deplibs(lto_module_t mod);
/**
* Returns the ith dependent library in the module.
*
+ * Deprecated. Now always returns null.
+ *
* \since LTO_API_VERSION=8
*/
extern const char*
@@ -300,6 +304,9 @@ lto_module_get_deplib(lto_module_t mod, unsigned int index);
/**
* Returns the number of linker options in the object module.
*
+ * Each linker option may consist of multiple flags. It is the linker's
+ * responsibility to split the flags using a platform-specific mechanism.
+ *
* \since LTO_API_VERSION=8
*/
extern unsigned int
@@ -309,6 +316,9 @@ lto_module_get_num_linkeropts(lto_module_t mod);
/**
* Returns the ith linker option in the module.
*
+ * Each linker option may consist of multiple flags. It is the linker's
+ * responsibility to split the flags using a platform-specific mechanism.
+ *
* \since LTO_API_VERSION=8
*/
extern const char*
OpenPOWER on IntegriCloud