Aligb section at end in tcc_load_object_file
Noticed this when the crt1.o file on an updated riscv had a text section where the size is not multiple of align. This file is loaded first and when the c code is then compiled the code is not aligned any more. This results in: alignment of code section not multiple of 4 in riscv64-gen.c
This commit is contained in:
parent
90ae383f62
commit
c6afdff7ab
1 changed files with 5 additions and 0 deletions
5
tccelf.c
5
tccelf.c
|
@ -3245,6 +3245,11 @@ invalid:
|
|||
} else {
|
||||
s->data_offset += size;
|
||||
}
|
||||
/* align end of section */
|
||||
/* This is needed if we compile a c file after this */
|
||||
if (s == text_section || s == data_section || s == rodata_section ||
|
||||
s == bss_section || s == common_section)
|
||||
s->data_offset += -s->data_offset & (s->sh_addralign - 1);
|
||||
next: ;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue