mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-17 23:54:16 +08:00
tccasm.c: Make .init and .fini sections executable
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
GAS selects default attributes for a section based on its name and makes the sections .text, .init, .fini executable. The crti.s and crtn.s files of musl rely on these defaults and don't set the "x" flag for the .init and .fini sections. Unfortunately TCC does not care for .init and .fini section defaults in assembler or C code. Fix this for assembler code.
This commit is contained in:
parent
2f88764100
commit
ba0899d909
4
tccasm.c
4
tccasm.c
@ -907,6 +907,10 @@ static void asm_parse_directive(TCCState *s1, int global)
|
||||
sets alignment to PTR_SIZE. The assembler behaves different. */
|
||||
if (old_nb_section != s1->nb_sections) {
|
||||
cur_text_section->sh_addralign = 1;
|
||||
/* Make .init and .fini sections executable by default.
|
||||
GAS does so, too, and musl relies on it. */
|
||||
if (!strcmp(sname, ".init") || !strcmp(sname, ".fini"))
|
||||
flags |= SHF_EXECINSTR;
|
||||
cur_text_section->sh_flags = flags;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user