[nasm:macho-unify] output: macho -- Beautify known sections

nasm-bot for Cyrill Gorcunov gorcunov at gmail.com
Tue Jun 30 17:03:00 PDT 2020


Commit-ID:  e0d858ce88d269b97e6fdf92e8748bd9c934ae62
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=e0d858ce88d269b97e6fdf92e8748bd9c934ae62
Author:     Cyrill Gorcunov <gorcunov at gmail.com>
AuthorDate: Thu, 3 May 2018 01:39:29 +0300
Committer:  Cyrill Gorcunov <gorcunov at gmail.com>
CommitDate: Wed, 9 May 2018 18:03:50 +0300

output: macho -- Beautify known sections

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>


---
 output/outmacho.c | 54 +++++++++++++++++++++++++++---------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/output/outmacho.c b/output/outmacho.c
index 9daac466..34385fa7 100644
--- a/output/outmacho.c
+++ b/output/outmacho.c
@@ -702,41 +702,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 }
 };
 


More information about the Nasm-commits mailing list