mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-11 17:08:42 +00:00
[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.
This commit is contained in:
parent
e253cdda35
commit
d6d640ebae
@ -1,2 +0,0 @@
|
||||
.section ".eh_frame", "a", @progbits
|
||||
.long 0
|
@ -3,7 +3,7 @@
|
||||
foo:
|
||||
ret
|
||||
|
||||
.section .eh_frame, "a"
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 12 # Size
|
||||
.long 0x00 # ID
|
||||
.byte 0x01 # Version.
|
||||
|
@ -1,2 +0,0 @@
|
||||
.section .debug_info
|
||||
.word __start
|
@ -10,7 +10,7 @@ getRodata:
|
||||
lwa 3, .LC0@toc(2)
|
||||
blr
|
||||
|
||||
.section .rodata,"aMS",@progbits,8
|
||||
.section .rodata,"a",@progbits
|
||||
.quad _start
|
||||
|
||||
.section .toc,"aw",@progbits
|
||||
|
@ -32,7 +32,7 @@ bar:
|
||||
.quad .text.bar1
|
||||
|
||||
## Don't warn on .eh_frame, .debug*, .zdebug*, or .gcc_except_table
|
||||
.section .eh_frame,"a"
|
||||
.section .eh_frame,"a",@unwind
|
||||
.quad .text.bar1
|
||||
|
||||
.section .debug_foo
|
||||
|
@ -17,7 +17,7 @@
|
||||
a_sym:
|
||||
nop
|
||||
|
||||
.section .debug_str,"",@progbits
|
||||
.section .debug_str,"MS",@progbits,1
|
||||
.long a_sym
|
||||
.long a_debug_sym
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// REQUIRES: x86
|
||||
// RUN: llvm-mc -filetype=obj -triple=amd64-unknown-openbsd %s -o %t.o
|
||||
// RUN: llvm-mc -filetype=obj -triple=amd64-unknown-openbsd %p/Inputs/eh-frame-end.s -o %t2.o
|
||||
// RUN: echo '.section .eh_frame,"a",@unwind; .long 0' | \
|
||||
// RUN: llvm-mc -filetype=obj -triple=amd64-unknown-openbsd - -o %t2.o
|
||||
// RUN: ld.lld %t.o %t2.o -o %t
|
||||
// RUN: llvm-readobj --sections %t | FileCheck %s
|
||||
|
||||
@ -13,5 +14,5 @@
|
||||
// CHECK-NEXT: Offset: 0x120
|
||||
// CHECK-NEXT: Size: 4
|
||||
|
||||
.section ".eh_frame", "a", @progbits
|
||||
.section .eh_frame,"a",@unwind
|
||||
__EH_FRAME_BEGIN__:
|
||||
|
@ -15,6 +15,6 @@
|
||||
// CHECK: Name: foo
|
||||
// CHECK-NEXT: Value: [[ADDR]]
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
foo:
|
||||
.long 0
|
||||
|
@ -57,7 +57,7 @@
|
||||
_start:
|
||||
nop
|
||||
|
||||
.section .eh_frame, "a"
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 16 # Size
|
||||
.long 0x00 # ID
|
||||
.byte 0x01 # Version.
|
||||
|
@ -57,7 +57,7 @@
|
||||
_start:
|
||||
nop
|
||||
|
||||
.section .eh_frame, "a"
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 16 # Size
|
||||
.long 0x00 # ID
|
||||
.byte 0x01 # Version.
|
||||
|
@ -57,7 +57,7 @@
|
||||
_start:
|
||||
nop
|
||||
|
||||
.section .eh_frame, "a"
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 16 # Size
|
||||
.long 0x00 # ID
|
||||
.byte 0x01 # Version.
|
||||
|
@ -11,7 +11,7 @@
|
||||
_start:
|
||||
ret
|
||||
|
||||
.section .eh_frame, "a"
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 12 # Size
|
||||
.long 0x00 # ID
|
||||
.byte 0x01 # Version.
|
||||
|
@ -3,7 +3,7 @@
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x14
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -3,7 +3,7 @@
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x14
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -3,7 +3,7 @@
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x0E
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -3,7 +3,7 @@
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x0E
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -3,7 +3,7 @@
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x14
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -3,7 +3,7 @@
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
# RUN: ld.lld --eh-frame-hdr %t -o /dev/null
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x14
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -53,7 +53,7 @@
|
||||
foo:
|
||||
nop
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 12 # Size
|
||||
.long 0x00 # ID
|
||||
.byte 0x01 # Version.
|
||||
|
@ -52,7 +52,7 @@
|
||||
foo:
|
||||
nop
|
||||
|
||||
.section .eh_frame, "ax"
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 12 # Size
|
||||
.long 0x00 # ID
|
||||
.byte 0x01 # Version.
|
||||
|
@ -4,7 +4,7 @@
|
||||
# RUN: not ld.lld --eh-frame-hdr %t.o -o /dev/null 2>&1 | FileCheck %s
|
||||
# CHECK: error: unknown FDE size encoding
|
||||
|
||||
.section .eh_frame, "ax"
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 12 # Size
|
||||
.long 0x00 # ID
|
||||
.byte 0x01 # Version.
|
||||
|
@ -23,7 +23,7 @@
|
||||
// DISASM-NEXT: 201154: {{.*}} movq 2097440, %rax
|
||||
// DISASM-NEXT: 20115c: {{.*}} movq 2097445, %rax
|
||||
|
||||
.section .eh_frame,"ax",@unwind
|
||||
.section .eh_frame,"a",@unwind
|
||||
|
||||
.section .text
|
||||
.globl _start
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
# CHECK-NOT: selected
|
||||
|
||||
.section ".eh_frame", "a", @progbits
|
||||
.section ".eh_frame", "a", @unwind
|
||||
.globl foo
|
||||
foo:
|
||||
.quad 0
|
||||
|
@ -3,7 +3,7 @@
|
||||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0
|
||||
|
||||
// CHECK: error: corrupted .eh_frame: CIE/FDE too small
|
||||
|
@ -3,7 +3,7 @@
|
||||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 42
|
||||
|
||||
// CHECK: error: corrupted .eh_frame: CIE/FDE ends past the end of the section
|
||||
|
@ -3,7 +3,7 @@
|
||||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 0xFFFFFFFC
|
||||
|
||||
// CHECK: error: corrupted .eh_frame: CIE/FDE ends past the end of the section
|
||||
|
@ -3,7 +3,7 @@
|
||||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 0xFFFFFFFF
|
||||
.byte 0
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 0xFFFFFFFF
|
||||
.quad 0xFFFFFFFFFFFFFFF4
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
|
||||
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 0x14
|
||||
.long 0x0
|
||||
.byte 0x01
|
||||
|
@ -6,7 +6,7 @@
|
||||
# CHECK: error: corrupted .eh_frame: unexpected end of CIE
|
||||
# CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0x8)
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x04
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -6,7 +6,7 @@
|
||||
# CHECK: error: corrupted .eh_frame: corrupted CIE (failed to read string)
|
||||
# CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0x9)
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.align 1
|
||||
.byte 0x08
|
||||
.byte 0x00
|
||||
|
@ -6,7 +6,7 @@
|
||||
# CHECK: error: corrupted .eh_frame: corrupted CIE (failed to read LEB128)
|
||||
# CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0xC)
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x08
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
# CHECK: corrupted .eh_frame: unknown .eh_frame augmentation string:
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x0E
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
# CHECK: corrupted .eh_frame: unknown .eh_frame augmentation string:
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x0E
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -6,7 +6,7 @@
|
||||
# CHECK: error: corrupted .eh_frame: unknown FDE encoding
|
||||
# CHECK-NEXT: >>> defined in {{.*}}:(.eh_frame+0xE)
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x0E
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
# CHECK: error: corrupted .eh_frame: DW_EH_PE_aligned encoding is not supported
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x0E
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
# CHECK: error: corrupted .eh_frame: corrupted CIE
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x0E
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
# CHECK: error: corrupted .eh_frame: CIE is too small
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x03
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -7,7 +7,7 @@
|
||||
// This resembles what gold -r produces when it discards the section
|
||||
// the fde points to.
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.long 0x14
|
||||
.long 0x0
|
||||
.byte 0x01
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
// CHECK: error: corrupted .eh_frame: FDE version 1 or 3 expected, but got 2
|
||||
|
||||
.section .eh_frame
|
||||
.section .eh_frame,"a",@unwind
|
||||
.byte 0x08
|
||||
.byte 0x00
|
||||
.byte 0x00
|
||||
|
@ -1,3 +1,3 @@
|
||||
.section .debug_str
|
||||
.section .debug_str,"MS",@progbits,1
|
||||
.asciz "CCC"
|
||||
.asciz "DDD"
|
||||
|
@ -26,7 +26,7 @@
|
||||
a_sym:
|
||||
nop
|
||||
|
||||
.section .debug_str,"",@progbits
|
||||
.section .debug_str,"MS",@progbits,1
|
||||
.long a_sym
|
||||
.long a_debug_sym
|
||||
|
||||
|
@ -31,6 +31,6 @@
|
||||
# ZLIBFLAGS-NEXT: Flags [
|
||||
# ZLIBFLAGS-NEXT: SHF_COMPRESSED
|
||||
|
||||
.section .debug_str
|
||||
.section .debug_str,"MS",@progbits,1
|
||||
.asciz "AAA"
|
||||
.asciz "BBB"
|
||||
|
@ -71,5 +71,5 @@ __start:
|
||||
.data
|
||||
.gpword __start # R_MIPS_GPREL32
|
||||
|
||||
.section .debug_info
|
||||
.section .debug_info,"",@0x7000001e
|
||||
.word __start # R_MIPS_32
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Check reading addends for relocations in non-allocatable sections.
|
||||
|
||||
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t1.o
|
||||
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
|
||||
# RUN: %S/Inputs/mips-nonalloc.s -o %t2.o
|
||||
# RUN: echo '.section .debug_info,"",@0x7000001e; .word __start' | \
|
||||
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux - -o %t2.o
|
||||
# RUN: ld.lld %t1.o %t2.o -o %t.exe
|
||||
# RUN: llvm-objdump -t -s %t.exe | FileCheck %s
|
||||
|
||||
@ -18,6 +18,6 @@
|
||||
__start:
|
||||
nop
|
||||
|
||||
.section .debug_info
|
||||
.section .debug_info,"",@0x7000001e
|
||||
.word 0xffffffff
|
||||
.word __start
|
||||
|
@ -8,7 +8,7 @@
|
||||
.global __start
|
||||
__start:
|
||||
|
||||
.section .eh_frame,"aw",@progbits
|
||||
.section .eh_frame,"a",@progbits
|
||||
.4byte 9
|
||||
.4byte 0x0
|
||||
.byte 0x1
|
||||
|
@ -36,7 +36,7 @@
|
||||
addis 3, 2, j@got@dtprel@h
|
||||
addi 3, 2, j@got@dtprel
|
||||
|
||||
.section .tbss,"awT",@progbits
|
||||
.section .tbss,"awT",@nobits
|
||||
.p2align 2
|
||||
i:
|
||||
.long 0
|
||||
|
Loading…
Reference in New Issue
Block a user