blob: cca12c01cb02044207c257789ecc44af32084d2c [file] [log] [blame]
Anton Korobeynikov745e8642008-07-19 13:14:46 +00001//===-- DarwinTargetAsmInfo.cpp - Darwin asm properties ---------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines target asm properties related what form asm statements
11// should take in general on Darwin-based targets
12//
13//===----------------------------------------------------------------------===//
14
15#include "llvm/Constants.h"
16#include "llvm/DerivedTypes.h"
17#include "llvm/Function.h"
18#include "llvm/GlobalVariable.h"
19#include "llvm/ADT/StringExtras.h"
Torok Edwinc25e7582009-07-11 20:10:48 +000020#include "llvm/Support/ErrorHandling.h"
Dale Johannesend2e51af2008-09-09 22:29:13 +000021#include "llvm/Support/Mangler.h"
Anton Korobeynikov745e8642008-07-19 13:14:46 +000022#include "llvm/Target/DarwinTargetAsmInfo.h"
23#include "llvm/Target/TargetMachine.h"
24#include "llvm/Target/TargetData.h"
25
26using namespace llvm;
27
Dan Gohman8f092252008-11-03 18:22:42 +000028DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM)
29 : TargetAsmInfo(TM) {
Chris Lattnerf0144122009-07-28 03:13:23 +000030
Chris Lattner4e0f25b2009-06-19 00:08:39 +000031 // Common settings for all Darwin targets.
32 // Syntax:
33 GlobalPrefix = "_";
34 PrivateGlobalPrefix = "L";
Chris Lattner90f8b702009-07-21 17:30:51 +000035 LinkerPrivateGlobalPrefix = "l"; // Marker for some ObjC metadata
Chris Lattner4e0f25b2009-06-19 00:08:39 +000036 NeedsSet = true;
37 NeedsIndirectEncoding = true;
38 AllowQuotesInName = true;
39 HasSingleParameterDotFile = false;
40
41 // In non-PIC modes, emit a special label before jump tables so that the
42 // linker can perform more accurate dead code stripping. We do not check the
43 // relocation model here since it can be overridden later.
44 JumpTableSpecialLabelPrefix = "l";
45
46 // Directives:
47 WeakDefDirective = "\t.weak_definition ";
48 WeakRefDirective = "\t.weak_reference ";
49 HiddenDirective = "\t.private_extern ";
50
51 // Sections:
Chris Lattner4e0f25b2009-06-19 00:08:39 +000052 if (TM.getRelocationModel() == Reloc::Static) {
53 StaticCtorsSection = ".constructor";
54 StaticDtorsSection = ".destructor";
55 } else {
56 StaticCtorsSection = ".mod_init_func";
57 StaticDtorsSection = ".mod_term_func";
58 }
59
Chris Lattnere2cf37b2009-07-17 20:46:40 +000060 // _foo.eh symbols are currently always exported so that the linker knows
61 // about them. This may not strictly be necessary on 10.6 and later, but it
62 // doesn't hurt anything.
63 Is_EHSymbolPrivate = false;
64
Chris Lattner4e0f25b2009-06-19 00:08:39 +000065 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
66 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
67 DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
68 DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
69 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
70 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
71 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
72 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
73 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
74 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
75 DwarfMacroInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
Anton Korobeynikov745e8642008-07-19 13:14:46 +000076}
77