| //===-- Definition of macros from elf.h -----------------------------------===// |
| // |
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| // See https://llvm.org/LICENSE.txt for license information. |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| // |
| //===----------------------------------------------------------------------===// |
| |
| #ifndef LLVM_LIBC_MACROS_ELF_MACROS_H |
| #define LLVM_LIBC_MACROS_ELF_MACROS_H |
| |
| // Symbol Table |
| |
| #define ELF32_ST_BIND(i) ((i) >> 4) |
| #define ELF32_ST_TYPE(i) ((i) & 0xf) |
| #define ELF32_ST_INFO(b, t) (((b) << 4) + ((t) & 0xf)) |
| |
| #define ELF64_ST_BIND(i) ((i) >> 4) |
| #define ELF64_ST_TYPE(i) ((i) & 0xf) |
| #define ELF64_ST_INFO(b, t) (((b) << 4) + ((t) & 0xf)) |
| |
| #define ELF32_ST_VISIBILITY(o) ((o) & 0x3) |
| #define ELF64_ST_VISIBILITY(o) ((o) & 0x3) |
| |
| // Relocations |
| |
| #define ELF32_R_SYM(i) ((i) >> 8) |
| #define ELF32_R_TYPE(i) ((unsigned char)(i)) |
| #define ELF32_R_INFO(s, t) (((s) << 8) + (unsigned char)(t)) |
| |
| #define ELF64_R_SYM(i) ((i) >> 32) |
| #define ELF64_R_TYPE(i) ((i) & 0xffffffffL) |
| #define ELF64_R_INFO(s, t) (((s) << 32) + ((t) & 0xffffffffL)) |
| |
| #endif // LLVM_LIBC_MACROS_ELF_MACROS_H |