| Issue |
113875
|
| Summary |
[llvm] I found a __attribute__((section())) that doesn't work in a specific scenario.
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Zhenhang1213
|
demo:
```
__attribute__((section(".custom"))) static const int data = ""
const int* get_data()
{
return &data;
}
int main()
{
(void)get_data();
}
```
`clang demo.c -c -o demo.o `
clang version 15.0.4
```
readelf -SW demo.o
There are 11 section headers, starting at offset 0x300:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00 0 0 0
[ 1] .strtab STRTAB 0000000000000000 00027a 000082 00 0 0 1
[ 2] .text PROGBITS 0000000000000000 000040 000024 00 AX 0 0 4
[ 3] .rela.text RELA 0000000000000000 000200 000048 18 I 10 2 8
[ 4] .custom PROGBITS 0000000000000000 000064 000004 00 A 0 0 4
[ 5] .comment PROGBITS 0000000000000000 000068 00003a 01 MS 0 0 1
[ 6] .note.GNU-stack PROGBITS 0000000000000000 0000a2 000000 00 0 0 1
[ 7] .eh_frame PROGBITS 0000000000000000 0000a8 000050 00 A 0 0 8
[ 8] .rela.eh_frame RELA 0000000000000000 000248 000030 18 I 10 7 8
[ 9] .llvm_addrsig LOOS+0xfff4c03 0000000000000000 000278 000002 00 E 10 0 1
[10] .symtab SYMTAB 0000000000000000 0000f8 000108 18 1 9 8
```
But if I delete function get_data, custom section wouldn't be generated, this is a bug?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs