commit 5063686bdb5446fc49f6df0ae0a2dbf1949f4401
parent 5b882ab2a1e8a571c724614a7a6527549f598be5
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 19 Jan 2025 12:15:30 +0100
objdump: Don't set CONTENTS in not allocated sections
If a section is not allocated it does not have any data allocated in the binary
file and thus it cannot have content, even when it is loaded into memory.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cmd/scc-objdump/main.c b/src/cmd/scc-objdump/main.c
@@ -182,7 +182,7 @@ dumpscns(Obj *obj)
setflag(&f, flags & SEXEC, SEC_CODE);
setflag(&f, (flags & (SEXEC|SLOAD)) == SLOAD, SEC_DATA);
setflag(&f, debug, SEC_DEBUGGING);
- setflag(&f, sec.size > 0, SEC_HAS_CONTENTS);
+ setflag(&f, (flags & SALLOC) && sec.size > 0, SEC_HAS_CONTENTS);
printsecflags(f);
}