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:
herman ten brugge 2024-12-27 09:19:03 +01:00
parent 90ae383f62
commit c6afdff7ab

View file

@ -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: ;
}