diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2018-05-03 01:39:29 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2018-10-24 22:49:03 +0300 |
commit | fbc92bdb666e6c40d1970faa920b8a28858add07 (patch) | |
tree | a4bbdbc9f0b329e2c7255b067e2f03eea6492f24 | |
parent | 68de05ca7933790b6de03178df3a2f79f6f13b6a (diff) | |
download | nasm-fbc92bdb666e6c40d1970faa920b8a28858add07.tar.gz |
output: macho -- Beautify known sections
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | output/outmacho.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/output/outmacho.c b/output/outmacho.c index 21e02e22..cb2c90a6 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -734,41 +734,41 @@ static void macho_output(int32_t secto, const void *data, } } +#define S_CODE (S_REGULAR | S_ATTR_SOME_INSTRUCTIONS | S_ATTR_PURE_INSTRUCTIONS) +#define NO_TYPE S_NASM_TYPE_MASK + /* Translation table from traditional Unix section names to Mach-O */ static const struct sectmap { - const char *nasmsect; - const char *segname; - const char *sectname; - const uint32_t flags; + const char *nasmsect; + const char *segname; + const char *sectname; + const uint32_t flags; } sectmap[] = { - {".text", "__TEXT", "__text", - S_REGULAR|S_ATTR_SOME_INSTRUCTIONS|S_ATTR_PURE_INSTRUCTIONS}, - {".data", "__DATA", "__data", S_REGULAR}, - {".rodata", "__DATA", "__const", S_REGULAR}, - {".bss", "__DATA", "__bss", S_ZEROFILL}, - {".debug_abbrev", "__DWARF", "__debug_abbrev", S_ATTR_DEBUG}, - {".debug_info", "__DWARF", "__debug_info", S_ATTR_DEBUG}, - {".debug_line", "__DWARF", "__debug_line", S_ATTR_DEBUG}, - {".debug_str", "__DWARF", "__debug_str", S_ATTR_DEBUG}, - {NULL, NULL, NULL, 0} + { ".text", "__TEXT", "__text", S_CODE }, + { ".data", "__DATA", "__data", S_REGULAR }, + { ".rodata", "__DATA", "__const", S_REGULAR }, + { ".bss", "__DATA", "__bss", S_ZEROFILL }, + { ".debug_abbrev", "__DWARF", "__debug_abbrev", S_ATTR_DEBUG }, + { ".debug_info", "__DWARF", "__debug_info", S_ATTR_DEBUG }, + { ".debug_line", "__DWARF", "__debug_line", S_ATTR_DEBUG }, + { ".debug_str", "__DWARF", "__debug_str", S_ATTR_DEBUG }, + { NULL, NULL, NULL, 0 } }; -#define NO_TYPE S_NASM_TYPE_MASK - /* Section type or attribute directives */ static const struct sect_attribs { - const char *name; - uint32_t flags; + const char *name; + uint32_t flags; } sect_attribs[] = { - { "data", S_REGULAR }, - { "code", S_REGULAR|S_ATTR_SOME_INSTRUCTIONS|S_ATTR_PURE_INSTRUCTIONS }, - { "mixed", S_REGULAR|S_ATTR_SOME_INSTRUCTIONS }, - { "bss", S_ZEROFILL }, - { "zerofill", S_ZEROFILL }, - { "no_dead_strip", NO_TYPE|S_ATTR_NO_DEAD_STRIP }, - { "live_support", NO_TYPE|S_ATTR_LIVE_SUPPORT }, - { "strip_static_syms", NO_TYPE|S_ATTR_STRIP_STATIC_SYMS }, - { "debug", NO_TYPE|S_ATTR_DEBUG }, + { "data", S_REGULAR }, + { "code", S_CODE }, + { "mixed", S_REGULAR | S_ATTR_SOME_INSTRUCTIONS }, + { "bss", S_ZEROFILL }, + { "zerofill", S_ZEROFILL }, + { "no_dead_strip", NO_TYPE | S_ATTR_NO_DEAD_STRIP }, + { "live_support", NO_TYPE | S_ATTR_LIVE_SUPPORT }, + { "strip_static_syms", NO_TYPE | S_ATTR_STRIP_STATIC_SYMS }, + { "debug", NO_TYPE | S_ATTR_DEBUG }, { NULL, 0 } }; |