Skip to content

Commit d6d640e

Browse files
committed
[ELF][test] Fix section sh_type and sh_flags
A future MC change may add a warning/error when a .section directive specifies incorrect sh_flags/sh_type.
1 parent e253cdd commit d6d640e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+49
-52
lines changed

lld/test/ELF/Inputs/eh-frame-end.s

Lines changed: 0 additions & 2 deletions
This file was deleted.

lld/test/ELF/Inputs/eh-frame-pcrel-overflow.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
foo:
44
ret
55

6-
.section .eh_frame, "a"
6+
.section .eh_frame,"a",@unwind
77
.long 12 # Size
88
.long 0x00 # ID
99
.byte 0x01 # Version.

lld/test/ELF/Inputs/mips-nonalloc.s

Lines changed: 0 additions & 2 deletions
This file was deleted.

lld/test/ELF/Inputs/ppc64-sort-small-cm-relocs-input4.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ getRodata:
1010
lwa 3, .LC0@toc(2)
1111
blr
1212

13-
.section .rodata,"aMS",@progbits,8
13+
.section .rodata,"a",@progbits
1414
.quad _start
1515

1616
.section .toc,"aw",@progbits

lld/test/ELF/comdat-discarded-reloc.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ bar:
3232
.quad .text.bar1
3333

3434
## Don't warn on .eh_frame, .debug*, .zdebug*, or .gcc_except_table
35-
.section .eh_frame,"a"
35+
.section .eh_frame,"a",@unwind
3636
.quad .text.bar1
3737

3838
.section .debug_foo

lld/test/ELF/compress-debug-sections-reloc.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
a_sym:
1818
nop
1919

20-
.section .debug_str,"",@progbits
20+
.section .debug_str,"MS",@progbits,1
2121
.long a_sym
2222
.long a_debug_sym
2323

lld/test/ELF/eh-frame-begin-end.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// REQUIRES: x86
22
// RUN: llvm-mc -filetype=obj -triple=amd64-unknown-openbsd %s -o %t.o
3-
// RUN: llvm-mc -filetype=obj -triple=amd64-unknown-openbsd %p/Inputs/eh-frame-end.s -o %t2.o
3+
// RUN: echo '.section .eh_frame,"a",@unwind; .long 0' | \
4+
// RUN: llvm-mc -filetype=obj -triple=amd64-unknown-openbsd - -o %t2.o
45
// RUN: ld.lld %t.o %t2.o -o %t
56
// RUN: llvm-readobj --sections %t | FileCheck %s
67

@@ -13,5 +14,5 @@
1314
// CHECK-NEXT: Offset: 0x120
1415
// CHECK-NEXT: Size: 4
1516

16-
.section ".eh_frame", "a", @progbits
17+
.section .eh_frame,"a",@unwind
1718
__EH_FRAME_BEGIN__:

lld/test/ELF/eh-frame-marker.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
// CHECK: Name: foo
1616
// CHECK-NEXT: Value: [[ADDR]]
1717

18-
.section .eh_frame
18+
.section .eh_frame,"a",@unwind
1919
foo:
2020
.long 0

lld/test/ELF/eh-frame-negative-pcrel-sdata2.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
_start:
5858
nop
5959

60-
.section .eh_frame, "a"
60+
.section .eh_frame,"a",@unwind
6161
.long 16 # Size
6262
.long 0x00 # ID
6363
.byte 0x01 # Version.

lld/test/ELF/eh-frame-negative-pcrel-sdata4.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
_start:
5858
nop
5959

60-
.section .eh_frame, "a"
60+
.section .eh_frame,"a",@unwind
6161
.long 16 # Size
6262
.long 0x00 # ID
6363
.byte 0x01 # Version.

lld/test/ELF/eh-frame-negative-pcrel-sdata8.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
_start:
5858
nop
5959

60-
.section .eh_frame, "a"
60+
.section .eh_frame,"a",@unwind
6161
.long 16 # Size
6262
.long 0x00 # ID
6363
.byte 0x01 # Version.

lld/test/ELF/eh-frame-pcrel-overflow.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
_start:
1212
ret
1313

14-
.section .eh_frame, "a"
14+
.section .eh_frame,"a",@unwind
1515
.long 12 # Size
1616
.long 0x00 # ID
1717
.byte 0x01 # Version.

lld/test/ELF/eh-frame-value-format1.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.byte 0x14
88
.byte 0x00
99
.byte 0x00

lld/test/ELF/eh-frame-value-format2.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.byte 0x14
88
.byte 0x00
99
.byte 0x00

lld/test/ELF/eh-frame-value-format3.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.byte 0x0E
88
.byte 0x00
99
.byte 0x00

lld/test/ELF/eh-frame-value-format4.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.byte 0x0E
88
.byte 0x00
99
.byte 0x00

lld/test/ELF/eh-frame-value-format5.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.byte 0x14
88
.byte 0x00
99
.byte 0x00

lld/test/ELF/eh-frame-value-format6.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.byte 0x14
88
.byte 0x00
99
.byte 0x00

lld/test/ELF/eh-frame-value-format7.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
foo:
5454
nop
5555

56-
.section .eh_frame
56+
.section .eh_frame,"a",@unwind
5757
.long 12 # Size
5858
.long 0x00 # ID
5959
.byte 0x01 # Version.

lld/test/ELF/eh-frame-value-format8.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
foo:
5353
nop
5454

55-
.section .eh_frame, "ax"
55+
.section .eh_frame,"a",@unwind
5656
.long 12 # Size
5757
.long 0x00 # ID
5858
.byte 0x01 # Version.

lld/test/ELF/eh-frame-value-format9.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# RUN: not ld.lld --eh-frame-hdr %t.o -o /dev/null 2>&1 | FileCheck %s
55
# CHECK: error: unknown FDE size encoding
66

7-
.section .eh_frame, "ax"
7+
.section .eh_frame,"a",@unwind
88
.long 12 # Size
99
.long 0x00 # ID
1010
.byte 0x01 # Version.

lld/test/ELF/ehframe-relocation.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// DISASM-NEXT: 201154: {{.*}} movq 2097440, %rax
2424
// DISASM-NEXT: 20115c: {{.*}} movq 2097445, %rax
2525

26-
.section .eh_frame,"ax",@unwind
26+
.section .eh_frame,"a",@unwind
2727

2828
.section .text
2929
.globl _start

lld/test/ELF/icf16.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# CHECK-NOT: selected
1111

12-
.section ".eh_frame", "a", @progbits
12+
.section ".eh_frame", "a", @unwind
1313
.globl foo
1414
foo:
1515
.quad 0

lld/test/ELF/invalid-cie-length.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.byte 0
88

99
// CHECK: error: corrupted .eh_frame: CIE/FDE too small

lld/test/ELF/invalid-cie-length2.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.long 42
88

99
// CHECK: error: corrupted .eh_frame: CIE/FDE ends past the end of the section

lld/test/ELF/invalid-cie-length3.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.long 0xFFFFFFFC
88

99
// CHECK: error: corrupted .eh_frame: CIE/FDE ends past the end of the section

lld/test/ELF/invalid-cie-length4.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.long 0xFFFFFFFF
88
.byte 0
99

lld/test/ELF/invalid-cie-length5.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.long 0xFFFFFFFF
88
.quad 0xFFFFFFFFFFFFFFF4
99

lld/test/ELF/invalid-cie-reference.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
44
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
55

6-
.section .eh_frame
6+
.section .eh_frame,"a",@unwind
77
.long 0x14
88
.long 0x0
99
.byte 0x01

lld/test/ELF/invalid-eh-frame.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# CHECK: error: corrupted .eh_frame: unexpected end of CIE
77
# CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0x8)
88

9-
.section .eh_frame
9+
.section .eh_frame,"a",@unwind
1010
.byte 0x04
1111
.byte 0x00
1212
.byte 0x00

lld/test/ELF/invalid-eh-frame2.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# CHECK: error: corrupted .eh_frame: corrupted CIE (failed to read string)
77
# CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0x9)
88

9-
.section .eh_frame
9+
.section .eh_frame,"a",@unwind
1010
.align 1
1111
.byte 0x08
1212
.byte 0x00

lld/test/ELF/invalid-eh-frame3.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# CHECK: error: corrupted .eh_frame: corrupted CIE (failed to read LEB128)
77
# CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0xC)
88

9-
.section .eh_frame
9+
.section .eh_frame,"a",@unwind
1010
.byte 0x08
1111
.byte 0x00
1212
.byte 0x00

lld/test/ELF/invalid-eh-frame4.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# CHECK: corrupted .eh_frame: unknown .eh_frame augmentation string:
77

8-
.section .eh_frame
8+
.section .eh_frame,"a",@unwind
99
.byte 0x0E
1010
.byte 0x00
1111
.byte 0x00

lld/test/ELF/invalid-eh-frame5.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# CHECK: corrupted .eh_frame: unknown .eh_frame augmentation string:
77

8-
.section .eh_frame
8+
.section .eh_frame,"a",@unwind
99
.byte 0x0E
1010
.byte 0x00
1111
.byte 0x00

lld/test/ELF/invalid-eh-frame6.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# CHECK: error: corrupted .eh_frame: unknown FDE encoding
77
# CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0xE)
88

9-
.section .eh_frame
9+
.section .eh_frame,"a",@unwind
1010
.byte 0x0E
1111
.byte 0x00
1212
.byte 0x00

lld/test/ELF/invalid-eh-frame7.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# CHECK: error: corrupted .eh_frame: DW_EH_PE_aligned encoding is not supported
77

8-
.section .eh_frame
8+
.section .eh_frame,"a",@unwind
99
.byte 0x0E
1010
.byte 0x00
1111
.byte 0x00

lld/test/ELF/invalid-eh-frame8.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# CHECK: error: corrupted .eh_frame: corrupted CIE
77

8-
.section .eh_frame
8+
.section .eh_frame,"a",@unwind
99
.byte 0x0E
1010
.byte 0x00
1111
.byte 0x00

lld/test/ELF/invalid-eh-frame9.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# CHECK: error: corrupted .eh_frame: CIE is too small
77

8-
.section .eh_frame
8+
.section .eh_frame,"a",@unwind
99
.byte 0x03
1010
.byte 0x00
1111
.byte 0x00

lld/test/ELF/invalid-fde-rel.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// This resembles what gold -r produces when it discards the section
88
// the fde points to.
99

10-
.section .eh_frame
10+
.section .eh_frame,"a",@unwind
1111
.long 0x14
1212
.long 0x0
1313
.byte 0x01

lld/test/ELF/invalid/eh-frame-hdr-no-out.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// CHECK: error: corrupted .eh_frame: FDE version 1 or 3 expected, but got 2
66

7-
.section .eh_frame
7+
.section .eh_frame,"a",@unwind
88
.byte 0x08
99
.byte 0x00
1010
.byte 0x00
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.section .debug_str
1+
.section .debug_str,"MS",@progbits,1
22
.asciz "CCC"
33
.asciz "DDD"

lld/test/ELF/linkerscript/compress-debug-sections-custom.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
a_sym:
2727
nop
2828

29-
.section .debug_str,"",@progbits
29+
.section .debug_str,"MS",@progbits,1
3030
.long a_sym
3131
.long a_debug_sym
3232

lld/test/ELF/linkerscript/compress-debug-sections.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
# ZLIBFLAGS-NEXT: Flags [
3232
# ZLIBFLAGS-NEXT: SHF_COMPRESSED
3333

34-
.section .debug_str
34+
.section .debug_str,"MS",@progbits,1
3535
.asciz "AAA"
3636
.asciz "BBB"

lld/test/ELF/mips-micro-relocs.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@ __start:
7171
.data
7272
.gpword __start # R_MIPS_GPREL32
7373

74-
.section .debug_info
74+
.section .debug_info,"",@0x7000001e
7575
.word __start # R_MIPS_32

0 commit comments

Comments
 (0)