From 9eb38b233e5353a80c7d99676a08fe87d87debdb Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 19 Jun 2014 22:14:12 +0000 Subject: Set missing options in LTOCodeGenerator::setTargetOptions. Patch by Tom Roeder, I just added the test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211317 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/LTO/LTOCodeGenerator.cpp | 5 +++++ test/LTO/jump-table-type.ll | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/LTO/jump-table-type.ll diff --git a/lib/LTO/LTOCodeGenerator.cpp b/lib/LTO/LTOCodeGenerator.cpp index 9009958613..2772676c8e 100644 --- a/lib/LTO/LTOCodeGenerator.cpp +++ b/lib/LTO/LTOCodeGenerator.cpp @@ -141,6 +141,11 @@ void LTOCodeGenerator::setTargetOptions(TargetOptions options) { Options.TrapFuncName = options.TrapFuncName; Options.PositionIndependentExecutable = options.PositionIndependentExecutable; Options.UseInitArray = options.UseInitArray; + Options.DataSections = options.DataSections; + Options.FunctionSections = options.FunctionSections; + + Options.MCOptions = options.MCOptions; + Options.JTType = options.JTType; } void LTOCodeGenerator::setDebugInfo(lto_debug_model debug) { diff --git a/test/LTO/jump-table-type.ll b/test/LTO/jump-table-type.ll new file mode 100644 index 0000000000..a39d3e9598 --- /dev/null +++ b/test/LTO/jump-table-type.ll @@ -0,0 +1,23 @@ +; RUN: llvm-as <%s >%t1 +; RUN: llvm-lto -o %t2 %t1 -jump-table-type=arity +; RUN: llvm-nm %t2 | FileCheck %s + +; CHECK: T __llvm_jump_instr_table_0_1 +; CHECK: T __llvm_jump_instr_table_1_1 + +target triple = "x86_64-unknown-linux-gnu" + +define i32 @g(i32 %a) unnamed_addr jumptable { + ret i32 %a +} + +define i32 @f() unnamed_addr jumptable { + ret i32 0 +} + +define i32 @main() { + ret i32 0 +} + +@llvm.used = appending global [2 x i8*] [i8* bitcast (i32(i32)* @g to i8*), + i8* bitcast (i32()* @f to i8*)] -- cgit v1.2.3