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
Unified · Split
| @@ -3245,6 +3245,11 @@ invalid: · 3244 unmodified lines | |||
| 3245 | } else { | 3245 | } else { |
| 3246 | s->data_offset += size; | 3246 | s->data_offset += size; |
| 3247 | } | 3247 | } |
| 3248 | /* align end of section */ | ||
| 3249 | /* This is needed if we compile a c file after this */ | ||
| 3250 | if (s == text_section || s == data_section || s == rodata_section || | ||
| 3251 | s == bss_section || s == common_section) | ||
| 3252 | s->data_offset += -s->data_offset & (s->sh_addralign - 1); | ||
| 3248 | next: ; | 3253 | next: ; |
| 3249 | } | 3254 | } |
| 3250 | 3255 | ||