From 0fca312236475ccc2de12da45221c311d99a19d1 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 24 Oct 2022 11:04:31 +0200 Subject: Use .data.rel.ro section for const data with relocatable inits on ELF targets (#457) Follow-up to ed89275cb. AArch64, ARM, RISC-V and x86 ELF targets are changed. PowerPC / ELF is unchanged because we use the EABI variant, which has no `.data.rel.ro` section as far as I can see in GCC's output. (The SVR4 variant has `.data.rel.ro` but does not have `.sdata2`, which CompCert uses.) Fixes: #454 --- arm/TargetPrinter.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'arm/TargetPrinter.ml') diff --git a/arm/TargetPrinter.ml b/arm/TargetPrinter.ml index 20ca59d6..b6362ca9 100644 --- a/arm/TargetPrinter.ml +++ b/arm/TargetPrinter.ml @@ -150,7 +150,10 @@ struct | Section_data i | Section_small_data i -> variable_section ~sec:".data" ~bss:".bss" i | Section_const i | Section_small_const i -> - variable_section ~sec:".section .rodata" i + variable_section + ~sec:".section .rodata" + ~reloc:".section .data.rel.ro,\"aw\",%progbits" + i | Section_string _ -> ".section .rodata" | Section_literal _ -> ".text" | Section_jumptable -> ".text" -- cgit