seems that symbols under nocode/NODATA should not produce elf symbols at all, not just elf symbols with no size. See commit 4c82b003420fabbb95e077866784badc1a49189b 5 insertions(+), 5 deletions(-)
Unified · Split
| @@ -509,11 +509,11 @@ ST_FUNC void put_extern_sym2(Sym *sym, int sh_num, · 508 unmodified lines | ||
| 509 | 509 | update_storage(sym); |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | −ST_FUNC void put_extern_sym(Sym *sym, Section *section, | |
| 513 | − addr_t value, unsigned long size) | |
| 512 | +ST_FUNC void put_extern_sym(Sym *sym, Section *s, addr_t value, unsigned long size) | |
| 514 | 513 | { |
| 515 | − int sh_num = section ? section->sh_num : SHN_UNDEF; | |
| 516 | − put_extern_sym2(sym, sh_num, value, size, 1); | |
| 514 | + if (nocode_wanted && (NODATA_WANTED || (s && s == cur_text_section))) | |
| 515 | + return; | |
| 516 | + put_extern_sym2(sym, s ? s->sh_num : SHN_UNDEF, value, size, 1); | |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | /* add a new relocation entry to symbol 'sym' in section 's' */ |
| @@ -5333,7 +5333,7 @@ ST_FUNC void unary(void) · 4813 unmodified lines | ||
| 5333 | 5333 | type.t |= VT_ARRAY; |
| 5334 | 5334 | type.ref->c = len; |
| 5335 | 5335 | sec = rodata_section; |
| 5336 | − vpush_ref(&type, sec, sec->data_offset, NODATA_WANTED ? 0 : len); | |
| 5336 | + vpush_ref(&type, sec, sec->data_offset, len); | |
| 5337 | 5337 | if (!NODATA_WANTED) |
| 5338 | 5338 | memcpy(section_ptr_add(sec, len), funcname, len); |
| 5339 | 5339 | next(); |