Merge "Add #defines for some key enums."

This commit is contained in:
Elliott Hughes 2017-06-16 20:56:03 +00:00 committed by Gerrit Code Review
commit 0c44c05166
3 changed files with 88 additions and 15 deletions

View file

@ -57,23 +57,20 @@ void* dlsym(void* handle, const char* _Nonnull symbol);
void* dlvsym(void* handle, const char* _Nonnull symbol, const char* _Nonnull version) __INTRODUCED_IN(24);
int dladdr(const void* addr, Dl_info* _Nonnull info);
enum {
#if defined(__LP64__)
RTLD_NOW = 2,
#else
RTLD_NOW = 0,
#endif
RTLD_LAZY = 1,
#define RTLD_LOCAL 0
#define RTLD_LAZY 0x00001
#define RTLD_NOW 0x00002
#define RTLD_NOLOAD 0x00004
#define RTLD_GLOBAL 0x00100
#define RTLD_NODELETE 0x01000
RTLD_LOCAL = 0,
#if defined(__LP64__)
RTLD_GLOBAL = 0x00100,
#else
RTLD_GLOBAL = 2,
#if !defined(__LP64__)
/* LP32 is broken for historical reasons. */
#undef RTLD_NOW
#define RTLD_NOW 0x00000
#undef RTLD_GLOBAL
#define RTLD_GLOBAL 0x00002
#endif
RTLD_NOLOAD = 4,
RTLD_NODELETE = 0x01000,
};
#if defined (__LP64__)
#define RTLD_DEFAULT __BIONIC_CAST(reinterpret_cast, void*, 0)

View file

@ -40,21 +40,37 @@ __BEGIN_DECLS
enum {
REG_R0 = 0,
#define REG_R0 REG_R0
REG_R1,
#define REG_R1 REG_R1
REG_R2,
#define REG_R2 REG_R2
REG_R3,
#define REG_R3 REG_R3
REG_R4,
#define REG_R4 REG_R4
REG_R5,
#define REG_R5 REG_R5
REG_R6,
#define REG_R6 REG_R6
REG_R7,
#define REG_R7 REG_R7
REG_R8,
#define REG_R8 REG_R8
REG_R9,
#define REG_R9 REG_R9
REG_R10,
#define REG_R10 REG_R10
REG_R11,
#define REG_R11 REG_R11
REG_R12,
#define REG_R12 REG_R12
REG_R13,
#define REG_R13 REG_R13
REG_R14,
#define REG_R14 REG_R14
REG_R15,
#define REG_R15 REG_R15
};
#define NGREG 18 /* Like glibc. */
@ -103,25 +119,45 @@ typedef struct ucontext {
enum {
REG_GS = 0,
#define REG_GS REG_GS
REG_FS,
#define REG_FS REG_FS
REG_ES,
#define REG_ES REG_ES
REG_DS,
#define REG_DS REG_DS
REG_EDI,
#define REG_EDI REG_EDI
REG_ESI,
#define REG_ESI REG_ESI
REG_EBP,
#define REG_EBP REG_EBP
REG_ESP,
#define REG_ESP REG_ESP
REG_EBX,
#define REG_EBX REG_EBX
REG_EDX,
#define REG_EDX REG_EDX
REG_ECX,
#define REG_ECX REG_ECX
REG_EAX,
#define REG_EAX REG_EAX
REG_TRAPNO,
#define REG_TRAPNO REG_TRAPNO
REG_ERR,
#define REG_ERR REG_ERR
REG_EIP,
#define REG_EIP REG_EIP
REG_CS,
#define REG_CS REG_CS
REG_EFL,
#define REG_EFL REG_EFL
REG_UESP,
#define REG_UESP REG_UESP
REG_SS,
#define REG_SS REG_SS
NGREG
#define NGREG NGREG
};
typedef int greg_t;
@ -237,29 +273,53 @@ typedef struct ucontext {
enum {
REG_R8 = 0,
#define REG_R8 REG_R8
REG_R9,
#define REG_R9 REG_R9
REG_R10,
#define REG_R10 REG_R10
REG_R11,
#define REG_R11 REG_R11
REG_R12,
#define REG_R12 REG_R12
REG_R13,
#define REG_R13 REG_R13
REG_R14,
#define REG_R14 REG_R14
REG_R15,
#define REG_R15 REG_R15
REG_RDI,
#define REG_RDI REG_RDI
REG_RSI,
#define REG_RSI REG_RSI
REG_RBP,
#define REG_RBP REG_RBP
REG_RBX,
#define REG_RBX REG_RBX
REG_RDX,
#define REG_RDX REG_RDX
REG_RAX,
#define REG_RAX REG_RAX
REG_RCX,
#define REG_RCX REG_RCX
REG_RSP,
#define REG_RSP REG_RSP
REG_RIP,
#define REG_RIP REG_RIP
REG_EFL,
#define REG_EFL REG_EFL
REG_CSGSFS,
#define REG_CSGSFS REG_CSGSFS
REG_ERR,
#define REG_ERR REG_ERR
REG_TRAPNO,
#define REG_TRAPNO REG_TRAPNO
REG_OLDMASK,
#define REG_OLDMASK REG_OLDMASK
REG_CR2,
#define REG_CR2 REG_CR2
NGREG
#define NGREG NGREG
};
typedef long greg_t;

View file

@ -1271,6 +1271,22 @@ TEST(dlfcn, dt_runpath_smoke) {
dlclose(handle);
}
TEST(dlfcn, RTLD_macros) {
#if !defined(RTLD_LOCAL)
#error no RTLD_LOCAL
#elif !defined(RTLD_LAZY)
#error no RTLD_LAZY
#elif !defined(RTLD_NOW)
#error no RTLD_NOW
#elif !defined(RTLD_NOLOAD)
#error no RTLD_NOLOAD
#elif !defined(RTLD_GLOBAL)
#error no RTLD_GLOBAL
#elif !defined(RTLD_NODELETE)
#error no RTLD_NODELETE
#endif
}
// Bionic specific tests
#if defined(__BIONIC__)