Remove explicit setting of the CFI jumptable section name, it does not appear

to be needed: jump table sections are created with .cfi.jumptable suffix. With
this change each jump table is placed in a separate section, which allows the
linker to re-order them.

Differential Revision: https://reviews.llvm.org/D46537

llvm-svn: 331680
This commit is contained in:
Dmitry Mikulin 2018-05-07 21:30:15 +00:00
parent 88ce10b77d
commit 738bac77c1
7 changed files with 12 additions and 18 deletions

View File

@ -1272,12 +1272,6 @@ void LowerTypeTestsModule::createJumpTable(
createJumpTableEntry(AsmOS, ConstraintOS, JumpTableArch, AsmArgs,
cast<Function>(Functions[I]->getGlobal()));
// Try to emit the jump table at the end of the text segment.
// Jump table must come after __cfi_check in the cross-dso mode.
// FIXME: this magic section name seems to do the trick.
F->setSection(ObjectFormat == Triple::MachO
? "__TEXT,__text,regular,pure_instructions"
: ".text.cfi");
// Align the whole table by entry size.
F->setAlignment(getJumpTableEntrySize());
// Skip prologue.

View File

@ -25,13 +25,13 @@ define void @h2() "target-features"="-thumb-mode" !type !1 {
!0 = !{i32 0, !"typeid1"}
!1 = !{i32 0, !"typeid2"}
; CHECK: define private void {{.*}} #[[AT:.*]] section ".text.cfi" align 4 {
; CHECK: define private void {{.*}} #[[AT:.*]] align 4 {
; CHECK-NEXT: entry:
; CHECK-NEXT: call void asm sideeffect "b.w $0\0Ab.w $1\0A", "s,s"(void ()* @f1.cfi, void ()* @g1.cfi)
; CHECK-NEXT: unreachable
; CHECK-NEXT: }
; CHECK: define private void {{.*}} #[[AA:.*]] section ".text.cfi" align 4 {
; CHECK: define private void {{.*}} #[[AA:.*]] align 4 {
; CHECK-NEXT: entry:
; CHECK-NEXT: call void asm sideeffect "b $0\0Ab $1\0Ab $2\0A", "s,s,s"(void ()* @f2.cfi, void ()* @g2.cfi, void ()* @h2.cfi)
; CHECK-NEXT: unreachable

View File

@ -39,10 +39,10 @@ define i1 @foo(i8* %p) {
ret i1 %z
}
; X64: define private void @[[JT0]]() #{{.*}} section ".text.cfi" align 8 {
; X64: define private void @[[JT0]]() #{{.*}} align 8 {
; X64: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(void ()* @f.cfi)
; X64: define private void @[[JT1]]() #{{.*}} section ".text.cfi" align 8 {
; X64: define private void @[[JT1]]() #{{.*}} align 8 {
; X64: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(void ()* @g.cfi)
; WASM32: ![[I0]] = !{i64 1}

View File

@ -22,5 +22,5 @@ declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
; WASM-NOT: !{i64 0}
; WASM-NOT: !{i64 1}
; X64: define private void @[[JT]]() #{{.*}} section ".text.cfi" align {{.*}} {
; X64: define private void @[[JT]]() #{{.*}} align {{.*}} {
; X64: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(void ()* @foo)

View File

@ -50,8 +50,8 @@ define i1 @foo(i8* %p) {
ret i1 %x
}
; X86: define private void @[[JT]]() #{{.*}} section ".text.cfi" align 8 {
; ARM: define private void @[[JT]]() #{{.*}} section ".text.cfi" align 4 {
; X86: define private void @[[JT]]() #{{.*}} align 8 {
; ARM: define private void @[[JT]]() #{{.*}} align 4 {
; CHECK: define internal void @__cfi_global_var_init() section ".text.startup" {
; CHECK-NEXT: entry:

View File

@ -48,10 +48,10 @@ define i1 @foo(i8* %p) {
ret i1 %x
}
; X86-LINUX: define private void @[[JT]]() #[[ATTR:.*]] section ".text.cfi" align 8 {
; X86-WIN32: define private void @[[JT]]() #[[ATTR:.*]] section ".text.cfi" align 8 {
; ARM: define private void @[[JT]]() #[[ATTR:.*]] section ".text.cfi" align 4 {
; THUMB: define private void @[[JT]]() #[[ATTR:.*]] section ".text.cfi" align 4 {
; X86-LINUX: define private void @[[JT]]() #[[ATTR:.*]] align 8 {
; X86-WIN32: define private void @[[JT]]() #[[ATTR:.*]] align 8 {
; ARM: define private void @[[JT]]() #[[ATTR:.*]] align 4 {
; THUMB: define private void @[[JT]]() #[[ATTR:.*]] align 4 {
; X86: jmp ${0:c}@plt
; X86-SAME: int3

View File

@ -19,7 +19,7 @@ entry:
ret i1 %0
}
; CHECK: define private void @[[JT]]() #{{.*}} section ".text.cfi" align {{.*}} {
; CHECK: define private void @[[JT]]() #{{.*}} align {{.*}} {
declare i1 @llvm.type.test(i8*, metadata) nounwind readnone