Fix include SHT_NOTE sections everywhere
This commit is contained in:
parent
0821940e26
commit
766bd82032
1 changed files with 7 additions and 1 deletions
8
tccelf.c
8
tccelf.c
|
@ -2779,6 +2779,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
|
|||
ElfW(Sym) *sym, *symtab;
|
||||
ElfW_Rel *rel;
|
||||
Section *s;
|
||||
unsigned int *used_offset;
|
||||
|
||||
lseek(fd, file_offset, SEEK_SET);
|
||||
if (tcc_object_type(fd, &ehdr) != AFF_BINTYPE_REL)
|
||||
|
@ -2794,6 +2795,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
|
|||
shdr = load_data(fd, file_offset + ehdr.e_shoff,
|
||||
sizeof(ElfW(Shdr)) * ehdr.e_shnum);
|
||||
sm_table = tcc_mallocz(sizeof(SectionMergeInfo) * ehdr.e_shnum);
|
||||
used_offset = tcc_mallocz(sizeof(*used_offset) * s1->nb_sections);
|
||||
|
||||
/* load section names */
|
||||
sh = &shdr[ehdr.e_shstrndx];
|
||||
|
@ -2890,6 +2892,8 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
|
|||
s->sh_addralign = sh->sh_addralign;
|
||||
s->sh_entsize = sh->sh_entsize;
|
||||
sm_table[i].new_section = 1;
|
||||
used_offset = tcc_realloc(used_offset, sizeof(*used_offset) * s1->nb_sections);
|
||||
used_offset[j] = 0;
|
||||
found:
|
||||
if (sh->sh_type != s->sh_type) {
|
||||
#if TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD
|
||||
|
@ -2904,7 +2908,8 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
|
|||
s->data_offset += -s->data_offset & (sh->sh_addralign - 1);
|
||||
if (sh->sh_addralign > s->sh_addralign)
|
||||
s->sh_addralign = sh->sh_addralign;
|
||||
sm_table[i].offset = s->data_offset;
|
||||
sm_table[i].offset = used_offset[j] + s->data_offset;
|
||||
used_offset[j] = sm_table[i].offset;
|
||||
sm_table[i].s = s;
|
||||
/* concatenate sections */
|
||||
size = sh->sh_size;
|
||||
|
@ -3049,6 +3054,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
|
|||
tcc_free(strtab);
|
||||
tcc_free(old_to_new_syms);
|
||||
tcc_free(sm_table);
|
||||
tcc_free(used_offset);
|
||||
tcc_free(strsec);
|
||||
tcc_free(shdr);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue