diff options
author | Ian Lance Taylor <iant@golang.org> | 2024-07-11 17:50:18 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2024-07-11 17:54:43 -0700 |
commit | b870086904cfd480cf4297525ece00d169482ec7 (patch) | |
tree | 38bd92ab03c83da821cc14a865a409994025bc6f | |
parent | 88ff0504ab3286df57e27514065494a30c365ec5 (diff) | |
download | gcc-b870086904cfd480cf4297525ece00d169482ec7.zip gcc-b870086904cfd480cf4297525ece00d169482ec7.tar.gz gcc-b870086904cfd480cf4297525ece00d169482ec7.tar.bz2 |
libbacktrace: correctly gather Mach-O symbol table
For PR libbacktrace/97082.
* macho.c (MACH_O_N_EXT): Don't define.
(MACH_O_N_UNDF): Define.
(macho_defined_symbol): Don't discard N_EXT symbols. Do
discard N_UNDF symbols.
-rw-r--r-- | libbacktrace/macho.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libbacktrace/macho.c b/libbacktrace/macho.c index 5ceff05..8f768f1 100644 --- a/libbacktrace/macho.c +++ b/libbacktrace/macho.c @@ -271,12 +271,14 @@ struct macho_nlist_64 /* Value found in nlist n_type field. */ -#define MACH_O_N_EXT 0x01 /* Extern symbol */ +#define MACH_O_N_STAB 0xe0 /* Stabs debugging symbol */ +#define MACH_O_N_TYPE 0x0e /* Mask for type bits */ + +/* Values found after masking with MACH_O_N_TYPE. */ +#define MACH_O_N_UNDF 0x00 /* Undefined symbol */ #define MACH_O_N_ABS 0x02 /* Absolute symbol */ -#define MACH_O_N_SECT 0x0e /* Defined in section */ +#define MACH_O_N_SECT 0x0e /* Defined in section from n_sect field */ -#define MACH_O_N_TYPE 0x0e /* Mask for type bits */ -#define MACH_O_N_STAB 0xe0 /* Stabs debugging symbol */ /* Information we keep for a Mach-O symbol. */ @@ -492,10 +494,10 @@ macho_defined_symbol (uint8_t type) { if ((type & MACH_O_N_STAB) != 0) return 0; - if ((type & MACH_O_N_EXT) != 0) - return 0; switch (type & MACH_O_N_TYPE) { + case MACH_O_N_UNDF: + return 0; case MACH_O_N_ABS: return 1; case MACH_O_N_SECT: |