Use a helper function and clang-format.

No functionality change.

llvm-svn: 211415
This commit is contained in:
Rafael Espindola 2014-06-20 22:37:01 +00:00
parent 03c2bfc2ef
commit becdf63f7d
1 changed files with 19 additions and 6 deletions

View File

@ -18,6 +18,22 @@
#include "llvm/MC/MCSectionMachO.h"
using namespace llvm;
static bool useCompactUnwind(const Triple &T) {
// Only on darwin.
if (!T.isOSDarwin())
return false;
// aarch64 always has it.
if (T.getArch() == Triple::arm64 || T.getArch() == Triple::aarch64)
return true;
// Use it on newer version of OS X.
if (T.isMacOSX() && !T.isMacOSXVersionLT(10, 6))
return true;
return false;
}
void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
// MachO
IsFunctionEHFrameSymbolPrivate = false;
@ -151,13 +167,10 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
COFFDebugSymbolsSection = nullptr;
if ((T.isMacOSX() && !T.isMacOSXVersionLT(10, 6)) ||
(T.isOSDarwin() &&
(T.getArch() == Triple::arm64 || T.getArch() == Triple::aarch64))) {
if (useCompactUnwind(T)) {
CompactUnwindSection =
Ctx->getMachOSection("__LD", "__compact_unwind",
MachO::S_ATTR_DEBUG,
SectionKind::getReadOnly());
Ctx->getMachOSection("__LD", "__compact_unwind", MachO::S_ATTR_DEBUG,
SectionKind::getReadOnly());
if (T.getArch() == Triple::x86_64 || T.getArch() == Triple::x86)
CompactUnwindDwarfEHFrameOnly = 0x04000000;