2009-08-22 20:48:53 +00:00
|
|
|
//===-- MCAsmInfoDarwin.cpp - Darwin asm properties -------------*- C++ -*-===//
|
2008-07-19 13:14:46 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines target asm properties related what form asm statements
|
|
|
|
// should take in general on Darwin-based targets
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-08-22 20:48:53 +00:00
|
|
|
#include "llvm/MC/MCAsmInfoDarwin.h"
|
2011-04-28 16:09:09 +00:00
|
|
|
#include "llvm/MC/MCContext.h"
|
|
|
|
#include "llvm/MC/MCExpr.h"
|
2015-01-09 18:55:42 +00:00
|
|
|
#include "llvm/MC/MCSectionMachO.h"
|
2008-07-19 13:14:46 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
2015-01-09 18:55:42 +00:00
|
|
|
bool MCAsmInfoDarwin::isSectionAtomizableBySymbols(
|
|
|
|
const MCSection &Section) const {
|
|
|
|
const MCSectionMachO &SMO = static_cast<const MCSectionMachO &>(Section);
|
|
|
|
|
|
|
|
// Sections holding 1 byte strings are atomized based on the data they
|
|
|
|
// contain.
|
|
|
|
// Sections holding 2 byte strings require symbols in order to be atomized.
|
|
|
|
// There is no dedicated section for 4 byte strings.
|
2015-01-19 21:11:14 +00:00
|
|
|
if (SMO.getType() == MachO::S_CSTRING_LITERALS)
|
2015-01-09 18:55:42 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
if (SMO.getSegmentName() == "__DATA" && SMO.getSectionName() == "__cfstring")
|
|
|
|
return false;
|
|
|
|
|
2015-02-12 23:11:59 +00:00
|
|
|
if (SMO.getSegmentName() == "__DATA" &&
|
|
|
|
SMO.getSectionName() == "__objc_classrefs")
|
|
|
|
return false;
|
|
|
|
|
2015-01-09 18:55:42 +00:00
|
|
|
switch (SMO.getType()) {
|
|
|
|
default:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// These sections are atomized at the element boundaries without using
|
|
|
|
// symbols.
|
|
|
|
case MachO::S_4BYTE_LITERALS:
|
|
|
|
case MachO::S_8BYTE_LITERALS:
|
|
|
|
case MachO::S_16BYTE_LITERALS:
|
|
|
|
case MachO::S_LITERAL_POINTERS:
|
|
|
|
case MachO::S_NON_LAZY_SYMBOL_POINTERS:
|
|
|
|
case MachO::S_LAZY_SYMBOL_POINTERS:
|
|
|
|
case MachO::S_MOD_INIT_FUNC_POINTERS:
|
|
|
|
case MachO::S_MOD_TERM_FUNC_POINTERS:
|
|
|
|
case MachO::S_INTERPOSING:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2011-12-20 02:50:00 +00:00
|
|
|
|
2010-01-20 06:34:14 +00:00
|
|
|
MCAsmInfoDarwin::MCAsmInfoDarwin() {
|
2009-06-19 00:08:39 +00:00
|
|
|
// Common settings for all Darwin targets.
|
|
|
|
// Syntax:
|
2014-03-29 07:33:24 +00:00
|
|
|
LinkerPrivateGlobalPrefix = "l";
|
2009-06-19 00:08:39 +00:00
|
|
|
HasSingleParameterDotFile = false;
|
2010-01-23 07:21:06 +00:00
|
|
|
HasSubsectionsViaSymbols = true;
|
2009-06-19 00:08:39 +00:00
|
|
|
|
2009-08-11 22:31:42 +00:00
|
|
|
AlignmentIsInBytes = false;
|
2010-01-26 20:21:43 +00:00
|
|
|
COMMDirectiveAlignmentIsInBytes = false;
|
2012-09-07 21:08:01 +00:00
|
|
|
LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
|
2009-08-11 22:39:40 +00:00
|
|
|
InlineAsmStart = " InlineAsm Start";
|
|
|
|
InlineAsmEnd = " InlineAsm End";
|
2009-08-11 22:31:42 +00:00
|
|
|
|
2009-06-19 00:08:39 +00:00
|
|
|
// Directives:
|
2013-12-02 23:04:51 +00:00
|
|
|
HasWeakDefDirective = true;
|
2013-12-10 21:37:41 +00:00
|
|
|
HasWeakDefCanBeHiddenDirective = true;
|
2009-06-19 00:08:39 +00:00
|
|
|
WeakRefDirective = "\t.weak_reference ";
|
2009-08-11 22:17:31 +00:00
|
|
|
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
|
2010-01-19 02:09:44 +00:00
|
|
|
HasMachoZeroFillDirective = true; // Uses .zerofill
|
2010-05-20 00:49:07 +00:00
|
|
|
HasMachoTBSSDirective = true; // Uses .tbss
|
2010-01-19 04:34:02 +00:00
|
|
|
HasStaticCtorDtorReferenceInStaticMode = true;
|
2010-12-04 00:31:13 +00:00
|
|
|
|
2010-12-22 21:51:29 +00:00
|
|
|
// FIXME: Change this once MC is the system assembler.
|
|
|
|
HasAggressiveSymbolFolding = false;
|
|
|
|
|
2010-01-23 06:53:23 +00:00
|
|
|
HiddenVisibilityAttr = MCSA_PrivateExtern;
|
2011-02-23 02:27:05 +00:00
|
|
|
HiddenDeclarationVisibilityAttr = MCSA_Invalid;
|
2011-11-29 02:39:58 +00:00
|
|
|
|
2010-01-23 06:53:23 +00:00
|
|
|
// Doesn't support protected visibility.
|
2011-11-29 02:39:58 +00:00
|
|
|
ProtectedVisibilityAttr = MCSA_Invalid;
|
2012-05-11 01:41:30 +00:00
|
|
|
|
2009-08-11 22:31:42 +00:00
|
|
|
HasDotTypeDotSizeDirective = false;
|
2010-01-23 05:51:36 +00:00
|
|
|
HasNoDeadStrip = true;
|
2010-08-31 23:50:19 +00:00
|
|
|
|
2012-06-22 01:25:12 +00:00
|
|
|
DwarfUsesRelocationsAcrossSections = false;
|
2014-02-13 14:44:26 +00:00
|
|
|
|
|
|
|
UseIntegratedAssembler = true;
|
2014-10-21 01:17:30 +00:00
|
|
|
SetDirectiveSuppressesReloc = true;
|
2015-04-28 01:37:11 +00:00
|
|
|
|
|
|
|
// FIXME: For now keep the previous behavior, AShr, matching the previous
|
|
|
|
// behavior of as(1) (both -q and -Q: resp. LLVM and gas v1.38).
|
|
|
|
// If/when this changes, the AArch64 Darwin special case can go away.
|
|
|
|
UseLogicalShr = false;
|
2008-07-19 13:14:46 +00:00
|
|
|
}
|