summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-02-12 03:13:00 -0800
committerH. Peter Anvin <hpa@zytor.com>2016-02-12 03:13:00 -0800
commit09b56b421a01863679a9c43e94cc5a675b9add81 (patch)
treeb44354799236eaee4b0df2efbe3f21d1174f48a3
parentc635497870ade8eb5c028e68278581879b04d52e (diff)
downloadnasm-09b56b421a01863679a9c43e94cc5a675b9add81.tar.gz
outmac: move the format definitions down to the format-specific code
Move the format definitions down the to where the format-specific initialization code lives. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--output/outmac.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/output/outmac.c b/output/outmac.c
index 75a7838d..1df45a30 100644
--- a/output/outmac.c
+++ b/output/outmac.c
@@ -100,28 +100,6 @@ struct macho_fmt {
uint32_t nlist_size; /* Nlist (symbol) size */
};
-static const struct macho_fmt macho32_fmt = {
- 4,
- MH_MAGIC,
- CPU_TYPE_I386,
- LC_SEGMENT,
- MACHO_HEADER_SIZE,
- MACHO_SEGCMD_SIZE,
- MACHO_SECTCMD_SIZE,
- MACHO_NLIST_SIZE
-};
-
-static const struct macho_fmt macho64_fmt = {
- 8,
- MH_MAGIC_64,
- CPU_TYPE_X86_64,
- LC_SEGMENT_64,
- MACHO_HEADER64_SIZE,
- MACHO_SEGCMD64_SIZE,
- MACHO_SECTCMD64_SIZE,
- MACHO_NLIST64_SIZE
-};
-
static const struct macho_fmt *fmt;
static void fwriteptr(uint64_t data, FILE * fp)
@@ -1512,6 +1490,17 @@ static void debug_section_relocs (struct section *s)
}
#ifdef OF_MACHO32
+static const struct macho_fmt macho32_fmt = {
+ 4,
+ MH_MAGIC,
+ CPU_TYPE_I386,
+ LC_SEGMENT,
+ MACHO_HEADER_SIZE,
+ MACHO_SEGCMD_SIZE,
+ MACHO_SECTCMD_SIZE,
+ MACHO_NLIST_SIZE
+};
+
static void macho32_init(void)
{
fmt = &macho32_fmt;
@@ -1542,6 +1531,17 @@ struct ofmt of_macho32 = {
#endif
#ifdef OF_MACHO64
+static const struct macho_fmt macho64_fmt = {
+ 8,
+ MH_MAGIC_64,
+ CPU_TYPE_X86_64,
+ LC_SEGMENT_64,
+ MACHO_HEADER64_SIZE,
+ MACHO_SEGCMD64_SIZE,
+ MACHO_SECTCMD64_SIZE,
+ MACHO_NLIST64_SIZE
+};
+
static void macho64_init(void)
{
fmt = &macho64_fmt;