mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Fix lld macho standalone build by including llvm/Config/llvm-config.h instead of llvm/Config/config.h
lld/MachO/Driver.cpp and lld/MachO/SyntheticSections.cpp include llvm/Config/config.h which doesn't exist when building standalone lld. This patch replaces llvm/Config/config.h include with llvm/Config/llvm-config.h just like it is in lld/ELF/Driver.cpp and HAVE_LIBXAR with LLVM_HAVE_LIXAR and moves LLVM_HAVE_LIBXAR from config.h to llvm-config.h Also it adds LLVM_HAVE_LIBXAR to LLVMConfig.cmake and links liblldMachO2.so with XAR_LIB if LLVM_HAVE_LIBXAR is set. Differential Revision: https://reviews.llvm.org/D102084
This commit is contained in:
parent
0dc8431dd3
commit
4faf75c7ac
@ -189,8 +189,8 @@ else()
|
||||
set(LLVM_ENABLE_TERMINFO 0)
|
||||
endif()
|
||||
|
||||
check_library_exists(xar xar_open "" HAVE_LIBXAR)
|
||||
if(HAVE_LIBXAR)
|
||||
check_library_exists(xar xar_open "" LLVM_HAVE_LIBXAR)
|
||||
if(LLVM_HAVE_LIBXAR)
|
||||
set(XAR_LIB xar)
|
||||
endif()
|
||||
|
||||
|
@ -111,6 +111,8 @@ set(LLVM_ENABLE_SHARED_LIBS @BUILD_SHARED_LIBS@)
|
||||
set(LLVM_DEFAULT_EXTERNAL_LIT "@LLVM_CONFIG_DEFAULT_EXTERNAL_LIT@")
|
||||
set(LLVM_LIT_ARGS "@LLVM_LIT_ARGS@")
|
||||
|
||||
set(LLVM_HAVE_LIBXAR "@LLVM_HAVE_LIBXAR@")
|
||||
|
||||
if(NOT TARGET LLVMSupport)
|
||||
@LLVM_CONFIG_INCLUDE_EXPORTS@
|
||||
@llvm_config_include_buildtree_only_exports@
|
||||
|
@ -220,9 +220,6 @@
|
||||
/* Define if the setupterm() function is supported this platform. */
|
||||
#cmakedefine LLVM_ENABLE_TERMINFO ${LLVM_ENABLE_TERMINFO}
|
||||
|
||||
/* Define if the xar_open() function is supported this platform. */
|
||||
#cmakedefine HAVE_LIBXAR ${HAVE_LIBXAR}
|
||||
|
||||
/* Define to 1 if you have the <termios.h> header file. */
|
||||
#cmakedefine HAVE_TERMIOS_H ${HAVE_TERMIOS_H}
|
||||
|
||||
|
@ -94,4 +94,7 @@
|
||||
/* Define to 1 to enable the experimental new pass manager by default */
|
||||
#cmakedefine01 LLVM_ENABLE_NEW_PASS_MANAGER
|
||||
|
||||
/* Define if the xar_open() function is supported on this platform. */
|
||||
#cmakedefine LLVM_HAVE_LIBXAR ${LLVM_HAVE_LIBXAR}
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
llvm_canonicalize_cmake_booleans(
|
||||
BUILD_SHARED_LIBS
|
||||
HAVE_LIBXAR
|
||||
LLVM_HAVE_LIBXAR
|
||||
HAVE_OCAMLOPT
|
||||
HAVE_OCAML_OUNIT
|
||||
LLVM_ENABLE_DIA_SDK
|
||||
|
@ -36,7 +36,7 @@ config.host_ldflags = '@HOST_LDFLAGS@'
|
||||
config.llvm_use_intel_jitevents = @LLVM_USE_INTEL_JITEVENTS@
|
||||
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
|
||||
config.have_zlib = @LLVM_ENABLE_ZLIB@
|
||||
config.have_libxar = @HAVE_LIBXAR@
|
||||
config.have_libxar = @LLVM_HAVE_LIBXAR@
|
||||
config.have_libxml2 = @LLVM_ENABLE_LIBXML2@
|
||||
config.have_dia_sdk = @LLVM_ENABLE_DIA_SDK@
|
||||
config.enable_ffi = @LLVM_ENABLE_FFI@
|
||||
|
@ -35,7 +35,7 @@ add_llvm_tool(llvm-objdump
|
||||
OtoolOptsTableGen
|
||||
)
|
||||
|
||||
if(HAVE_LIBXAR)
|
||||
if(LLVM_HAVE_LIBXAR)
|
||||
target_link_libraries(llvm-objdump PRIVATE ${XAR_LIB})
|
||||
endif()
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include <cstring>
|
||||
#include <system_error>
|
||||
|
||||
#ifdef HAVE_LIBXAR
|
||||
#ifdef LLVM_HAVE_LIBXAR
|
||||
extern "C" {
|
||||
#include <xar/xar.h>
|
||||
}
|
||||
@ -184,7 +184,7 @@ typedef std::pair<uint64_t, DiceRef> DiceTableEntry;
|
||||
typedef std::vector<DiceTableEntry> DiceTable;
|
||||
typedef DiceTable::iterator dice_table_iterator;
|
||||
|
||||
#ifdef HAVE_LIBXAR
|
||||
#ifdef LLVM_HAVE_LIBXAR
|
||||
namespace {
|
||||
struct ScopedXarFile {
|
||||
xar_t xar;
|
||||
@ -211,7 +211,7 @@ struct ScopedXarIter {
|
||||
operator xar_iter_t() { return iter; }
|
||||
};
|
||||
} // namespace
|
||||
#endif // defined(HAVE_LIBXAR)
|
||||
#endif // defined(LLVM_HAVE_LIBXAR)
|
||||
|
||||
// This is used to search for a data in code table entry for the PC being
|
||||
// disassembled. The j parameter has the PC in j.first. A single data in code
|
||||
@ -1697,12 +1697,12 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
|
||||
StringRef DisSegName, StringRef DisSectName);
|
||||
static void DumpProtocolSection(MachOObjectFile *O, const char *sect,
|
||||
uint32_t size, uint32_t addr);
|
||||
#ifdef HAVE_LIBXAR
|
||||
#ifdef LLVM_HAVE_LIBXAR
|
||||
static void DumpBitcodeSection(MachOObjectFile *O, const char *sect,
|
||||
uint32_t size, bool verbose,
|
||||
bool PrintXarHeader, bool PrintXarFileHeaders,
|
||||
std::string XarMemberName);
|
||||
#endif // defined(HAVE_LIBXAR)
|
||||
#endif // defined(LLVM_HAVE_LIBXAR)
|
||||
|
||||
static void DumpSectionContents(StringRef Filename, MachOObjectFile *O,
|
||||
bool verbose) {
|
||||
@ -1773,13 +1773,13 @@ static void DumpSectionContents(StringRef Filename, MachOObjectFile *O,
|
||||
DumpProtocolSection(O, sect, sect_size, sect_addr);
|
||||
continue;
|
||||
}
|
||||
#ifdef HAVE_LIBXAR
|
||||
#ifdef LLVM_HAVE_LIBXAR
|
||||
if (SegName == "__LLVM" && SectName == "__bundle") {
|
||||
DumpBitcodeSection(O, sect, sect_size, verbose, SymbolicOperands,
|
||||
ArchiveHeaders, "");
|
||||
continue;
|
||||
}
|
||||
#endif // defined(HAVE_LIBXAR)
|
||||
#endif // defined(LLVM_HAVE_LIBXAR)
|
||||
switch (section_type) {
|
||||
case MachO::S_REGULAR:
|
||||
DumpRawSectionContents(O, sect, sect_size, sect_addr);
|
||||
@ -6460,7 +6460,7 @@ static void DumpProtocolSection(MachOObjectFile *O, const char *sect,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBXAR
|
||||
#ifdef LLVM_HAVE_LIBXAR
|
||||
static inline void swapStruct(struct xar_header &xar) {
|
||||
sys::swapByteOrder(xar.magic);
|
||||
sys::swapByteOrder(xar.size);
|
||||
@ -6823,7 +6823,7 @@ static void DumpBitcodeSection(MachOObjectFile *O, const char *sect,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // defined(HAVE_LIBXAR)
|
||||
#endif // defined(LLVM_HAVE_LIBXAR)
|
||||
|
||||
static void printObjcMetaData(MachOObjectFile *O, bool verbose) {
|
||||
if (O->is64Bit())
|
||||
|
@ -53,9 +53,9 @@ write_lit_cfg("lit_site_cfg") {
|
||||
}
|
||||
|
||||
if (llvm_enable_libxar) {
|
||||
extra_values += [ "HAVE_LIBXAR=1" ]
|
||||
extra_values += [ "LLVM_HAVE_LIBXAR=1" ]
|
||||
} else {
|
||||
extra_values += [ "HAVE_LIBXAR=0" ] # Must be 0.
|
||||
extra_values += [ "LLVM_HAVE_LIBXAR=0" ] # Must be 0.
|
||||
}
|
||||
|
||||
if (llvm_enable_libxml2) {
|
||||
|
@ -296,12 +296,6 @@ write_cmake_config("config") {
|
||||
values += [ "HAVE_LIBEDIT=" ]
|
||||
}
|
||||
|
||||
if (llvm_enable_libxar) {
|
||||
values += [ "HAVE_LIBXAR=1" ]
|
||||
} else {
|
||||
values += [ "HAVE_LIBXAR=" ]
|
||||
}
|
||||
|
||||
if (llvm_enable_terminfo) {
|
||||
values += [ "LLVM_ENABLE_TERMINFO=1" ]
|
||||
} else {
|
||||
@ -368,6 +362,12 @@ write_cmake_config("llvm-config") {
|
||||
]
|
||||
}
|
||||
|
||||
if (llvm_enable_libxar) {
|
||||
values += [ "LLVM_HAVE_LIBXAR=1" ]
|
||||
} else {
|
||||
values += [ "LLVM_HAVE_LIBXAR=" ]
|
||||
}
|
||||
|
||||
if (llvm_enable_threads) {
|
||||
values += [ "LLVM_ENABLE_THREADS=1" ]
|
||||
} else {
|
||||
|
@ -162,9 +162,9 @@ write_lit_config("lit_site_cfg") {
|
||||
}
|
||||
|
||||
if (llvm_enable_libxar) {
|
||||
extra_values += [ "HAVE_LIBXAR=1" ]
|
||||
extra_values += [ "LLVM_HAVE_LIBXAR=1" ]
|
||||
} else {
|
||||
extra_values += [ "HAVE_LIBXAR=0" ] # Must be 0.
|
||||
extra_values += [ "LLVM_HAVE_LIBXAR=0" ] # Must be 0.
|
||||
}
|
||||
|
||||
if (llvm_enable_dia_sdk) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user