mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-13 14:35:54 +00:00
fb13e8ff55
Summary: This fixes a dumpbin warning on objects produced by the MC assembler when starting from text. All .debug$S sections are supposed to be marked IMAGE_SCN_MEM_DISCARDABLE. The main, non-COMDAT .debug$S section had this set, but any comdat ones were not being marked discardable because there was no .section flag for it. This change does two things: - If the section name starts with .debug, implicitly mark the section as discardable. This means we do the same thing as gas on .s files with DWARF from GCC, which is important. - Adds the 'D' flag to the .section directive on COFF to explicitly say a section is discardable. We only emit this flag if the section name does not start with .debug. This allows the user to explicitly tweak their section flags without worrying about magic section names. The only thing you can't do in this scheme is to create a non-discardable section with a name starting with ".debug", but hopefully users don't need that. Reviewers: majnemer, rafael Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D24582 llvm-svn: 281554
195 lines
5.9 KiB
ArmAsm
195 lines
5.9 KiB
ArmAsm
// RUN: llvm-mc -triple i386-pc-win32 -filetype=obj %s | llvm-readobj -s | FileCheck %s
|
|
// RUN: llvm-mc -triple x86_64-pc-win32 -filetype=obj %s | llvm-readobj -s | FileCheck %s
|
|
|
|
.section .foo$bar; .long 1
|
|
.section .foo@bar; .long 1
|
|
.section ABCDEFGHIJKLMNOPQRSTUVWXYZ; .long 1
|
|
.section abcdefghijklmnopqrstuvwxyz; .long 1
|
|
.section _0123456789; .long 1
|
|
|
|
// CHECK: Sections [
|
|
// CHECK: Section {
|
|
// CHECK: Name: .foo$bar
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: .foo@bar
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: abcdefghijklmnopqrstuvwxyz
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: _0123456789
|
|
// CHECK: }
|
|
|
|
// Test that the defaults are used
|
|
.section s ; .long 1
|
|
.section s_, "" ; .long 1
|
|
.section s_a,"a"; .long 1
|
|
.section s_b,"b"; .long 1
|
|
.section s_d,"d"; .long 1
|
|
.section s_D,"D"; .long 1
|
|
.section s_n,"n"; .long 1
|
|
.section s_r,"r"; .long 1
|
|
.section s_s,"s"; .long 1
|
|
.section s_w,"w"; .long 1
|
|
.section s_x,"x"; .long 1
|
|
.section s_y,"y"; .long 1
|
|
|
|
// CHECK: Section {
|
|
// CHECK: Name: s
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_WRITE
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_WRITE
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_a
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_WRITE
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_b
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_UNINITIALIZED_DATA
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_WRITE
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_d
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_WRITE
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_D
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_DISCARDABLE
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_WRITE
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_n
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_LNK_REMOVE
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_WRITE
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_r
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_s
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_SHARED
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_WRITE
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_w
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_WRITE
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_x
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_CODE
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_EXECUTE
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_y
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
|
|
// w makes read-only to readable
|
|
.section s_rw,"rw"; .long 1
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_rw
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_WRITE
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
|
|
// r cancels w
|
|
.section s_wr,"wr"; .long 1
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_wr
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
|
|
// y cancels both
|
|
.section s_rwy,"rwy"; .long 1
|
|
// CHECK: Section {
|
|
// CHECK: Name: s_rwy
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
|
|
// Sections starting with ".debug" are implicitly discardable. This is
|
|
// compatible with gas.
|
|
.section .debug_asdf,"dr"; .long 1
|
|
// CHECK: Section {
|
|
// CHECK: Name: .debug_asdf
|
|
// CHECK: Characteristics [
|
|
// CHECK-NEXT: IMAGE_SCN_ALIGN_1BYTES
|
|
// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_DISCARDABLE
|
|
// CHECK-NEXT: IMAGE_SCN_MEM_READ
|
|
// CHECK-NEXT: ]
|
|
// CHECK: }
|
|
|
|
|
|
// CHECK: ]
|