mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-30 02:32:08 +00:00
d80d8690af
Chris recently broke llvmc with his Makefile changes (r75379). That patch made the global change .o -> .a, which caused built-in llvmc plugins to stop working since plugin initialization in llvmc is based on static variables not referenced from the main executable. This patch implements auto-generated forced references to the plugin libraries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74000 91177308-0d34-0410-b5e6-96231b3b80d8
83 lines
2.0 KiB
C++
83 lines
2.0 KiB
C++
//===--- ForceLinkage.h - The LLVM Compiler Driver --------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open
|
|
// Source License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// A bit of preprocessor magic to force references to static libraries. Needed
|
|
// because plugin initialization is done via static variables.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_INCLUDE_COMPILER_DRIVER_FORCE_LINKAGE_H
|
|
#define LLVM_INCLUDE_COMPILER_DRIVER_FORCE_LINKAGE_H
|
|
|
|
#include "llvm/CompilerDriver/ForceLinkageMacros.h"
|
|
|
|
namespace llvmc {
|
|
|
|
// Declare all ForceLinkage$(PluginName) functions.
|
|
|
|
#ifdef LLVMC_BUILTIN_PLUGIN_1
|
|
LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_1);
|
|
#endif
|
|
|
|
#ifdef LLVMC_BUILTIN_PLUGIN_2
|
|
LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_2);
|
|
#endif
|
|
|
|
#ifdef LLVMC_BUILTIN_PLUGIN_3
|
|
LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_3);
|
|
#endif
|
|
|
|
#ifdef LLVMC_BUILTIN_PLUGIN_4
|
|
LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_4);
|
|
#endif
|
|
|
|
#ifdef LLVMC_BUILTIN_PLUGIN_5
|
|
LLVMC_FORCE_LINKAGE_DECL(LLVMC_BUILTIN_PLUGIN_5);
|
|
#endif
|
|
|
|
namespace force_linkage {
|
|
|
|
struct LinkageForcer {
|
|
|
|
LinkageForcer() {
|
|
|
|
// Call all ForceLinkage$(PluginName) functions.
|
|
#ifdef LLVMC_BUILTIN_PLUGIN_1
|
|
LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_1);
|
|
#endif
|
|
|
|
#ifdef LLVMC_BUILTIN_PLUGIN_2
|
|
LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_2);
|
|
#endif
|
|
|
|
#ifdef LLVMC_BUILTIN_PLUGIN_3
|
|
LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_3);
|
|
#endif
|
|
|
|
#ifdef LLVMC_BUILTIN_PLUGIN_4
|
|
LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_4);
|
|
#endif
|
|
|
|
#ifdef LLVMC_BUILTIN_PLUGIN_5
|
|
LLVMC_FORCE_LINKAGE_CALL(LLVMC_BUILTIN_PLUGIN_5);
|
|
#endif
|
|
|
|
}
|
|
};
|
|
} // End namespace force_linkage.
|
|
|
|
// The only externally used bit.
|
|
void ForceLinkage() {
|
|
force_linkage::LinkageForcer dummy;
|
|
}
|
|
|
|
} // End namespace llvmc.
|
|
|
|
#endif // LLVM_INCLUDE_COMPILER_DRIVER_FORCE_LINKAGE_H
|