Fangrui Song 2b17366207
[Object] Refine isData/isBSS criteria
In GNU, DATA applies to not only SHT_PROGBITS, but also other non-NOBITS
types. BSS doesn't require the SHF_WRITE flag.

Pull Request: https://github.com/llvm/llvm-project/pull/101290
2024-08-05 10:05:54 -07:00

56 lines
1.2 KiB
Plaintext

# RUN: yaml2obj %s -o %t
# RUN: llvm-nm --no-sort %t | FileCheck %s
# CHECK: b mybss_local
# CHECK-NEXT: b mybss2_local
# CHECK-NEXT: d mydata_local
# CHECK-NEXT: d mydata2_local
# CHECK-NEXT: d mytdata_local
# CHECK-NEXT: B mybss_global
# CHECK-NEXT: D mydata_global
# CHECK-NEXT: D mytdata_global
!ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: mybss
Type: SHT_NOBITS
Flags: [ SHF_ALLOC, SHF_WRITE ]
- Name: mybss2
Type: SHT_NOBITS
Flags: [ SHF_ALLOC ]
- Name: mydata
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_WRITE ]
- Name: mydata2
Type: 0x1000
Flags: [ SHF_ALLOC, SHF_WRITE ]
- Name: mytdata
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_WRITE, SHF_TLS ]
Symbols:
- Name: mybss_local
Section: mybss
- Name: mybss2_local
Section: mybss2
- Name: mydata_local
Section: mydata
- Name: mydata2_local
Section: mydata2
- Name: mytdata_local
Section: mytdata
- Name: mybss_global
Binding: STB_GLOBAL
Section: mybss
- Name: mydata_global
Binding: STB_GLOBAL
Section: mydata
- Name: mytdata_global
Binding: STB_GLOBAL
Section: mytdata