From 4afa730c03c01aac26f8a41eb5cb19622b7afa14 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 18 Feb 2016 10:55:00 -0800 Subject: [PATCH] outmacho: default section flags should depend on section name only The __TEXT segment in particular contains both code and data. The most consistent thing is to look only at the section name, and have the same behavior across sections. Signed-off-by: H. Peter Anvin --- output/outmacho.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index 98a440d3..6179cc70 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -36,9 +36,6 @@ * NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X object files */ -/* Most of this file is, like Mach-O itself, based on a.out. For more - * guidelines see outaout.c. */ - #include "compiler.h" #include @@ -710,10 +707,10 @@ static int32_t macho_section(char *name, int pass, int *bits) nasm_error(ERR_NONFATAL, "section name %s too long\n", section); } - if (!strcmp(segment, "__TEXT")) { + if (!strcmp(section, "__text")) { flags = S_REGULAR | S_ATTR_SOME_INSTRUCTIONS | S_ATTR_PURE_INSTRUCTIONS; - } else if (!strcmp(segment, "__DATA") && !strcmp(section, "__bss")) { + } else if (!strcmp(section, "__bss")) { flags = S_ZEROFILL; } else { flags = S_REGULAR;