From c81519e1c45e4f902332d72096680caeb6e087e2 Mon Sep 17 00:00:00 2001 From: grischka Date: Sat, 28 May 2022 20:50:09 +0200 Subject: [PATCH] tccgen: don't generate elf-symbols under nocode/NODATA 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(-) --- tccgen.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tccgen.c b/tccgen.c index 184ba54a..55242099 100644 --- a/tccgen.c +++ b/tccgen.c @@ -509,11 +509,11 @@ ST_FUNC void put_extern_sym2(Sym *sym, int sh_num, update_storage(sym); } -ST_FUNC void put_extern_sym(Sym *sym, Section *section, - addr_t value, unsigned long size) +ST_FUNC void put_extern_sym(Sym *sym, Section *s, addr_t value, unsigned long size) { - int sh_num = section ? section->sh_num : SHN_UNDEF; - put_extern_sym2(sym, sh_num, value, size, 1); + if (nocode_wanted && (NODATA_WANTED || (s && s == cur_text_section))) + return; + put_extern_sym2(sym, s ? s->sh_num : SHN_UNDEF, value, size, 1); } /* add a new relocation entry to symbol 'sym' in section 's' */ @@ -5333,7 +5333,7 @@ ST_FUNC void unary(void) type.t |= VT_ARRAY; type.ref->c = len; sec = rodata_section; - vpush_ref(&type, sec, sec->data_offset, NODATA_WANTED ? 0 : len); + vpush_ref(&type, sec, sec->data_offset, len); if (!NODATA_WANTED) memcpy(section_ptr_add(sec, len), funcname, len); next(); -- 2.11.4.GIT