File: XCoreTargetObjectFile.cpp

package info (click to toggle)
llvm 2.6-9.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 57,604 kB
  • ctags: 44,336
  • sloc: cpp: 344,766; sh: 12,407; ansic: 10,617; ada: 3,070; ml: 2,505; perl: 2,496; makefile: 1,426; pascal: 1,163; exp: 389; asm: 307; python: 298; objc: 260; lisp: 182; csh: 117; xml: 38; f90: 36; tcl: 20
file content (74 lines) | stat: -rw-r--r-- 3,551 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//===-- XCoreTargetObjectFile.cpp - XCore object files --------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "XCoreTargetObjectFile.h"
#include "XCoreSubtarget.h"
#include "MCSectionXCore.h"
#include "llvm/Target/TargetMachine.h"
using namespace llvm;


void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
  TargetLoweringObjectFileELF::Initialize(Ctx, TM);

  DataSection =
    MCSectionXCore::Create(".dp.data", MCSectionELF::SHT_PROGBITS, 
                           MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
                           MCSectionXCore::SHF_DP_SECTION,
                           SectionKind::getDataRel(), false, getContext());
  BSSSection =
    MCSectionXCore::Create(".dp.bss", MCSectionELF::SHT_NOBITS,
                           MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
                           MCSectionXCore::SHF_DP_SECTION,
                           SectionKind::getBSS(), false, getContext());
  
  MergeableConst4Section = 
    MCSectionXCore::Create(".cp.rodata.cst4", MCSectionELF::SHT_PROGBITS,
                           MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
                           MCSectionXCore::SHF_CP_SECTION,
                           SectionKind::getMergeableConst4(), false,
                           getContext());
  MergeableConst8Section = 
    MCSectionXCore::Create(".cp.rodata.cst8", MCSectionELF::SHT_PROGBITS,
                           MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
                           MCSectionXCore::SHF_CP_SECTION,
                           SectionKind::getMergeableConst8(), false,
                           getContext());
  MergeableConst16Section = 
    MCSectionXCore::Create(".cp.rodata.cst16", MCSectionELF::SHT_PROGBITS,
                           MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
                           MCSectionXCore::SHF_CP_SECTION,
                           SectionKind::getMergeableConst16(), false,
                           getContext());
  
  // TLS globals are lowered in the backend to arrays indexed by the current
  // thread id. After lowering they require no special handling by the linker
  // and can be placed in the standard data / bss sections.
  TLSDataSection = DataSection;
  TLSBSSSection = BSSSection;
  
  if (TM.getSubtarget<XCoreSubtarget>().isXS1A())
    ReadOnlySection =   // FIXME: Why is this a writable section for XS1A?
      MCSectionXCore::Create(".dp.rodata", MCSectionELF::SHT_PROGBITS,
                             MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
                             MCSectionXCore::SHF_DP_SECTION,
                             SectionKind::getDataRel(), false, getContext());
  else
    ReadOnlySection = 
      MCSectionXCore::Create(".cp.rodata", MCSectionELF::SHT_PROGBITS,
                             MCSectionELF::SHF_ALLOC |
                             MCSectionXCore::SHF_CP_SECTION,
                             SectionKind::getReadOnlyWithRel(), false,
                             getContext());

  // Dynamic linking is not supported. Data with relocations is placed in the
  // same section as data without relocations.
  DataRelSection = DataRelLocalSection = DataSection;
  DataRelROSection = DataRelROLocalSection = ReadOnlySection;
}