Index: lib/CodeGen/BackendUtil.cpp =================================================================== --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -536,7 +536,6 @@ Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS; Options.UnsafeFPMath = CodeGenOpts.UnsafeFPMath; Options.StackAlignmentOverride = CodeGenOpts.StackAlignment; - Options.TrapFuncName = CodeGenOpts.TrapFuncName; Options.PositionIndependentExecutable = LangOpts.PIELevel != 0; Options.FunctionSections = CodeGenOpts.FunctionSections; Options.DataSections = CodeGenOpts.DataSections; Index: lib/CodeGen/CGCall.cpp =================================================================== --- lib/CodeGen/CGCall.cpp +++ lib/CodeGen/CGCall.cpp @@ -1483,6 +1483,9 @@ if (!CodeGenOpts.StackRealignment) FuncAttrs.addAttribute("no-realign-stack"); + if (!CodeGenOpts.TrapFuncName.empty()) + FuncAttrs.addAttribute("trap-func-name", CodeGenOpts.TrapFuncName); + // Add target-cpu and target-features attributes to functions. If // we have a decl for the function and it has a target attribute then // parse that and add it to the feature set. Index: test/CodeGen/fn-attr.c =================================================================== --- /dev/null +++ test/CodeGen/fn-attr.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -triple thumbv7-apple-ios5 -function-attribute trap-func-name=trapfuncname1 -emit-llvm -o - %s | FileCheck %s + +// CHECK: attributes #0 = { {{.*}} "trap-func-name"="trapfuncname1" + +int foo1(int a) { return a; }