mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-24 10:00:07 +08:00
Don't use stale section data pointers
put_elf_reloca might reallocate the section into which we point, so don't remember the pointer just the offset.
This commit is contained in:
parent
468e59206b
commit
30814dfacf
8
tccgen.c
8
tccgen.c
@ -8034,10 +8034,10 @@ static void init_putv(init_params *p, CType *type, unsigned long c)
|
||||
includes relocations. Use the fact that relocs are
|
||||
created it order, so look from the end of relocs
|
||||
until we hit one before the copied region. */
|
||||
int num_relocs = ssec->reloc->data_offset / sizeof(*rel);
|
||||
rel = (ElfW_Rel*)(ssec->reloc->data + ssec->reloc->data_offset);
|
||||
while (num_relocs--) {
|
||||
rel--;
|
||||
unsigned long relofs = ssec->reloc->data_offset;
|
||||
while (relofs >= sizeof(*rel)) {
|
||||
relofs -= sizeof(*rel);
|
||||
rel = (ElfW_Rel*)(ssec->reloc->data + relofs);
|
||||
if (rel->r_offset >= esym->st_value + size)
|
||||
continue;
|
||||
if (rel->r_offset < esym->st_value)
|
||||
|
Loading…
Reference in New Issue
Block a user