diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-01-01 23:53:30 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-01-03 15:04:41 +0300 |
commit | de623f267918a316e1c8c9fa63ccee67922470cf (patch) | |
tree | fdff1a73c5ac1952ddc9211181421e41385ddd27 | |
parent | 126faf2e3b59ec80b1f9e0e23bbfa2bc3619c562 (diff) | |
download | nasm-de623f267918a316e1c8c9fa63ccee67922470cf.tar.gz |
elf.h: Add ELFXX_ST_MKBIND and move ELFXX_ST_ helpers
The profit of ELFXX_ST_MKBIND helper is that we
will use it for SYM_GLOBAL explicitly pointing
out from where this magic 0x10 came from.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | output/elf.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/output/elf.h b/output/elf.h index 4ee8635e..ebdbfe6c 100644 --- a/output/elf.h +++ b/output/elf.h @@ -251,6 +251,17 @@ #define STV_HIDDEN 2 /* Sym unavailable in other modules */ #define STV_PROTECTED 3 /* Not preemptible, not exported */ +/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field */ +#define ELF32_ST_BIND(i) ((i) >> 4) +#define ELF32_ST_MKBIND(i) ((i) << 4) /* just a helper */ +#define ELF32_ST_TYPE(i) ((i) & 0xf) +#define ELF32_ST_INFO(b, i) (ELF_ST_MKBIND(b) + ELF_ST_TYPE(i)) + +#define ELF64_ST_BIND(i) ELF32_ST_BIND(i) +#define ELF64_ST_MKBIND(i) ELF32_ST_MKBIND(i) +#define ELF64_ST_TYPE(i) ELF32_ST_TYPE(i) +#define ELF64_ST_INFO(b, i) ELF32_ST_INFO(b, i) + /* * ELF standard typedefs (yet more proof that <stdint.h> was way overdue) */ @@ -520,12 +531,4 @@ typedef struct elf64_note { Elf64_Word n_type; /* Content type */ } Elf64_Nhdr; -/* How to extract and insert information held in the st_info field. */ -#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) -#define ELF32_ST_TYPE(val) ((val) & 0xf) - -/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ -#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) -#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) - #endif /* OUTPUT_ELF_H */ |