Commit f3a42743 by Milad Fa Committed by GitHub

Initial support for AIX (#1021)

* Init support of AIX

* make sysinfo change AIX specific

* Relocate TBF

* Add comments for .csect psudo op.
parent 020619c4
...@@ -318,8 +318,16 @@ ...@@ -318,8 +318,16 @@
// `__start_ ## name` and `__stop_ ## name` symbols to bracket the section. // `__start_ ## name` and `__stop_ ## name` symbols to bracket the section.
// This functionality is supported by GNU linker. // This functionality is supported by GNU linker.
#ifndef ABSL_ATTRIBUTE_SECTION_VARIABLE #ifndef ABSL_ATTRIBUTE_SECTION_VARIABLE
#ifdef _AIX
// __attribute__((section(#name))) on AIX is achived by using the `.csect` psudo
// op which includes an additional integer as part of its syntax indcating
// alignment. If data fall under different alignments then you might get a
// compilation error indicating a `Section type conflict`.
#define ABSL_ATTRIBUTE_SECTION_VARIABLE(name)
#else
#define ABSL_ATTRIBUTE_SECTION_VARIABLE(name) __attribute__((section(#name))) #define ABSL_ATTRIBUTE_SECTION_VARIABLE(name) __attribute__((section(#name)))
#endif #endif
#endif
// ABSL_DECLARE_ATTRIBUTE_SECTION_VARS // ABSL_DECLARE_ATTRIBUTE_SECTION_VARS
// //
......
...@@ -408,10 +408,10 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || ...@@ -408,10 +408,10 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
// POSIX.1-2001. // POSIX.1-2001.
#ifdef ABSL_HAVE_MMAP #ifdef ABSL_HAVE_MMAP
#error ABSL_HAVE_MMAP cannot be directly set #error ABSL_HAVE_MMAP cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \ defined(_AIX) || defined(__ros__) || defined(__native_client__) || \
defined(__wasm__) || defined(__Fuchsia__) || defined(__sun) || \ defined(__asmjs__) || defined(__wasm__) || defined(__Fuchsia__) || \
defined(__ASYLO__) || defined(__myriad2__) defined(__sun) || defined(__ASYLO__) || defined(__myriad2__)
#define ABSL_HAVE_MMAP 1 #define ABSL_HAVE_MMAP 1
#endif #endif
...@@ -422,7 +422,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || ...@@ -422,7 +422,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM #ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM
#error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set #error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__ros__) defined(_AIX) || defined(__ros__)
#define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1 #define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1
#endif #endif
......
...@@ -131,6 +131,8 @@ static int GetNumCPUs() { ...@@ -131,6 +131,8 @@ static int GetNumCPUs() {
#elif defined(_WIN32) #elif defined(_WIN32)
const unsigned hardware_concurrency = Win32NumCPUs(); const unsigned hardware_concurrency = Win32NumCPUs();
return hardware_concurrency ? hardware_concurrency : 1; return hardware_concurrency ? hardware_concurrency : 1;
#elif defined(_AIX)
return sysconf(_SC_NPROCESSORS_ONLN);
#else #else
// Other possibilities: // Other possibilities:
// - Read /sys/devices/system/cpu/online and use cpumask_parse() // - Read /sys/devices/system/cpu/online and use cpumask_parse()
......
...@@ -87,6 +87,10 @@ int64_t UnscaledCycleClock::Now() { ...@@ -87,6 +87,10 @@ int64_t UnscaledCycleClock::Now() {
double UnscaledCycleClock::Frequency() { double UnscaledCycleClock::Frequency() {
#ifdef __GLIBC__ #ifdef __GLIBC__
return __ppc_get_timebase_freq(); return __ppc_get_timebase_freq();
#elif defined(_AIX)
// This is the same constant value as returned by
// __ppc_get_timebase_freq().
return static_cast<double>(512000000);
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
static once_flag init_timebase_frequency_once; static once_flag init_timebase_frequency_once;
static double timebase_frequency = 0.0; static double timebase_frequency = 0.0;
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#if defined(ABSL_HAVE_ALARM) #if defined(ABSL_HAVE_ALARM)
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#elif defined(_AIX)
typedef void (*sig_t)(int);
#elif defined(__linux__) || defined(__APPLE__) #elif defined(__linux__) || defined(__APPLE__)
#error all known Linux and Apple targets have alarm #error all known Linux and Apple targets have alarm
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment