Issue 52955
Summary pragma section and optimization, initialized static variable in unexpected section
Labels new issue
Assignees
Reporter delmu1
    Compiling for arm with and without optimization gets different sections for the initialized static variable myvar:

Unexpected section:

clang --target=thumbv7em-unknown-none-eabi -O1 -c main.c
llvm-objdump.exe .\main.o –t
-	shows that the static initialized variable myvar is in section .bss instead of section .data.myvar as expected:
-   00000004 l     O .bss   00000001 myvar

Expected (correct) section without optimization (level 0):

clang --target=thumbv7em-unknown-none-eabi -O0 -c main.c
llvm-objdump.exe .\main.o –t
-	shows that the static initialized variable myvar is in section .data.myvar instead of section .data as expected:
-   00000000 l     O .data_myvar    00000004 myvar
[main.zip](https://github.com/llvm/llvm-project/files/7799176/main.zip)


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to