This patch fixes a small bug where symbols defined in the INIT
and FINI sections were incorrectly getting a type of 'n'.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
This copied a bug from GNU nm.
static const struct section_to_type stt[] =
{
{".bss", 'b'},
{"code", 't'}, /* MRI .text */
{".data", 'd'},
{"*DEBUG*", 'N'},
{".debug", 'N'}, /* MSVC's .debug (non-standard debug syms) */
{".drectve", 'i'}, /* MSVC's .drective section */
{".edata", 'e'}, /* MSVC's .edata (export) section */
{".fini", 't'}, /* ELF fini section */
{".idata", 'i'}, /* MSVC's .idata (import) section */
{".init", 't'}, /* ELF init section */
{".pdata", 'p'}, /* MSVC's .pdata (stack unwind) section */
{".rdata", 'r'}, /* Read only data. */
{".rodata", 'r'}, /* Read only data. */
{".sbss", 's'}, /* Small BSS (uninitialized data). */
{".scommon", 'c'}, /* Small common. */
{".sdata", 'g'}, /* Small initialized data. */
{".text", 't'},
{"vars", 'd'}, /* MRI .data */
{"zerovars", 'b'}, /* MRI .bss */
{0, 0}
};
/* Return the single-character symbol type corresponding to
section S, or '?' for an unknown COFF section.
Check for any leading string which matches, so .text5 returns
't' as well as .text */
static char
coff_section_type (const char *s)
{
const struct section_to_type *t;
for (t = &stt[0]; t->section; t++)
if (!strncmp (s, t->section, strlen (t->section))) ///////// symbols in ".init_array" are incorrectly marked "t"
return t->type;
return '?';
}The behavior is not consistent with a symbol defined in .preinit_array, e.g.
d __preinit_array_start t __init_array_start
The more sensible choice is probably to mark both as d.