summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2016-02-18 10:55:00 -0800
committerH. Peter Anvin <hpa@linux.intel.com>2016-02-18 10:55:00 -0800
commit4afa730c03c01aac26f8a41eb5cb19622b7afa14 (patch)
tree7608ebb54034d7e92239de1bebcd31e992c99ae7
parent9e122a6603af15472d2acdcf8563fcd0fc96bb0c (diff)
downloadnasm-4afa730c03c01aac26f8a41eb5cb19622b7afa14.tar.gz
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 <hpa@linux.intel.com>
-rw-r--r--output/outmacho.c7
1 files 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 <stdio.h>
@@ -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;