History

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(-)

grischka committed 4 years ago

Commit c81519e1 parent e8adc641 file · +5 −5Browse files

Unified · Split

tccgen.c+5−5
@@ -509,11 +509,11 @@ ST_FUNC void put_extern_sym2(Sym *sym, int sh_num, · 508 unmodified lines
509509 update_storage(sym);
510510 }
511511
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)
514513 {
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);
517517 }
518518
519519 /* add a new relocation entry to symbol 'sym' in section 's' */
@@ -5333,7 +5333,7 @@ ST_FUNC void unary(void) · 4813 unmodified lines
53335333 type.t |= VT_ARRAY;
53345334 type.ref->c = len;
53355335 sec = rodata_section;
5336− vpush_ref(&type, sec, sec->data_offset, NODATA_WANTED ? 0 : len);
5336+ vpush_ref(&type, sec, sec->data_offset, len);
53375337 if (!NODATA_WANTED)
53385338 memcpy(section_ptr_add(sec, len), funcname, len);
53395339 next();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t