Add AIX support to Path.inc, Host.h, and CMake.

Patch by Andrew Paprocki!

Differential Revision: https://reviews.llvm.org/D18359

llvm-svn: 276045
This commit is contained in:
Chandler Carruth 2016-07-19 22:46:39 +00:00
parent 84fd4bee6c
commit 2aff750cb8
5 changed files with 13 additions and 7 deletions

View File

@ -643,7 +643,7 @@ endif()
# check its symbols. This is wasteful (the check was done when foo.so
# was created) and can fail since it is not the dynamic linker and
# doesn't know how to handle search paths correctly.
if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS|AIX")
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
endif()

View File

@ -69,6 +69,9 @@ function(add_llvm_symbol_exports target_name export_file)
COMMENT "Creating export file for ${target_name}")
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-bE:${export_file}")
elseif(LLVM_HAVE_LINK_VERSION_SCRIPT)
# Gold and BFD ld require a version script rather than a plain list.
set(native_export_file "${target_name}.exports")
@ -156,7 +159,7 @@ function(add_link_opts target_name)
# Pass -O3 to the linker. This enabled different optimizations on different
# linkers.
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin|SunOS" OR WIN32))
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin|SunOS|AIX" OR WIN32))
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-O3")
endif()

View File

@ -79,11 +79,11 @@ else(WIN32)
if(UNIX)
set(LLVM_ON_WIN32 0)
set(LLVM_ON_UNIX 1)
if(APPLE)
if(APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
else(APPLE)
else()
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
endif(APPLE)
endif()
else(UNIX)
MESSAGE(SEND_ERROR "Unable to determine platform")
endif(UNIX)

View File

@ -18,6 +18,8 @@
#if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__)
#include <endian.h>
#elif defined(_AIX)
#include <sys/machine.h>
#else
#if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32)
#include <machine/endian.h>

View File

@ -90,7 +90,8 @@ namespace sys {
namespace fs {
#if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \
defined(__OpenBSD__) || defined(__minix) || defined(__FreeBSD_kernel__) || \
defined(__linux__) || defined(__CYGWIN__) || defined(__DragonFly__)
defined(__linux__) || defined(__CYGWIN__) || defined(__DragonFly__) || \
defined(_AIX)
static int
test_dir(char ret[PATH_MAX], const char *dir, const char *bin)
{
@ -161,7 +162,7 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
}
#elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \
defined(__OpenBSD__) || defined(__minix) || defined(__DragonFly__) || \
defined(__FreeBSD_kernel__)
defined(__FreeBSD_kernel__) || defined(_AIX)
char exe_path[PATH_MAX];
if (getprogpath(exe_path, argv0) != NULL)