[PATCH] Link in codegen components in llvm-c

This allows the use of shadow stack from the llvm-c API.
I am not sure this is the place to insert the include, though.

Index: include/llvm-c/ExecutionEngine.h

This allows the use of shadow stack from the llvm-c API. I am not sure this is the place to insert the include, though.

Hi Jonathan,

I can't accept this patch. It pulls a bunch of C++ code into what is explicitly a C header, with the wrong linkage to boot.

A more appropriate solution would be to add a binding like "void LLVMInitCodeGen(void)", defined alone in a compilation unit that #include's LinkAllCodegenComponents. The AsmWriter also has a similar header, although it isn't necessary for the ShadowStackCollector.

To the list: The GC components have no public symbols; they are discoverable only through static ctors. LinkAllCodegenComponents.h introduces a use of a function that has no raison d'être save to be used by this header. This prevents the linker from omitting the "unused" compilation unit when linking with the archive. The back ends are packed as objects to avoid this problem. Is there no better way to force the linker to run these static ctors?

Index: include/llvm-c/ExecutionEngine.h

--- include/llvm-c/ExecutionEngine.h (revision 56175)
+++ include/llvm-c/ExecutionEngine.h (working copy)
@@ -24,6 +24,7 @@

#ifdef __cplusplus
extern "C" {
+#include "llvm/LinkAllCodegenComponents.h"
#endif

typedef struct LLVMOpaqueGenericValue *LLVMGenericValueRef;

— Gordon