[PATCH] D19137: [cfi] Support explicit sections for functions in cfi-icall.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 16:11:29 PDT 2016


eugenis created this revision.
eugenis added a reviewer: pcc.
eugenis added a subscriber: llvm-commits.
eugenis set the repository for this revision to rL LLVM.

Allow explicit section for indirectly called functions in cfi-icall.
Jumptables for functions in the same type class must be contiguous, so they
always go to the default text section.

Repository:
  rL LLVM

http://reviews.llvm.org/D19137

Files:
  lib/Transforms/IPO/LowerBitSets.cpp
  test/Transforms/LowerBitSets/section.ll

Index: test/Transforms/LowerBitSets/section.ll
===================================================================
--- /dev/null
+++ test/Transforms/LowerBitSets/section.ll
@@ -0,0 +1,26 @@
+; Test that functions with "section" attribute are accepted, and jumptables are
+; emitted in ".text".
+
+; RUN: opt -S -lowerbitsets < %s | FileCheck %s
+
+target triple = "x86_64-unknown-linux-gnu"
+
+; CHECK: @[[A:.*]] = private constant {{.*}} section ".text"
+; CHECK: @f = alias void (), bitcast ({{.*}}* @[[A]] to void ()*)
+; CHECK: define private void {{.*}} section "xxx"
+
+define void @f() section "xxx" {
+entry:
+  ret void
+}
+
+define i1 @g() {
+entry:
+  %0 = call i1 @llvm.bitset.test(i8* bitcast (void ()* @f to i8*), metadata !"_ZTSFvE")
+  ret i1 %0
+}
+
+declare i1 @llvm.bitset.test(i8*, metadata) nounwind readnone
+
+!llvm.bitsets = !{!0}
+!0 = !{!"_ZTSFvE", void ()* @f, i64 0}
Index: lib/Transforms/IPO/LowerBitSets.cpp
===================================================================
--- lib/Transforms/IPO/LowerBitSets.cpp
+++ lib/Transforms/IPO/LowerBitSets.cpp
@@ -639,8 +639,6 @@
 
   if (OpGlobal->isThreadLocal())
     report_fatal_error("Bit set element may not be thread-local");
-  if (OpGlobal->hasSection())
-    report_fatal_error("Bit set element may not have an explicit section");
 
   if (isa<GlobalVariable>(OpGlobal) && OpGlobal->isDeclarationForLinker())
     report_fatal_error("Bit set global var element must be a definition");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19137.53801.patch
Type: text/x-patch
Size: 1472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160414/785e48cd/attachment.bin>


More information about the llvm-commits mailing list