mirror of
https://github.com/TinyCC/tinycc.git
synced 2025-11-16 12:34:45 +00:00
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:
5
tccelf.c
5
tccelf.c
@@ -3245,6 +3245,11 @@ invalid:
|
|||||||
} else {
|
} else {
|
||||||
s->data_offset += size;
|
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: ;
|
next: ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user