1 //===-- AVRTargetObjectFile.cpp - AVR Object Files ------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "AVRTargetObjectFile.h"
12 #include "llvm/BinaryFormat/ELF.h"
13 #include "llvm/IR/DerivedTypes.h"
14 #include "llvm/IR/GlobalValue.h"
15 #include "llvm/IR/Mangler.h"
16 #include "llvm/MC/MCContext.h"
17 #include "llvm/MC/MCSectionELF.h"
22 void AVRTargetObjectFile::Initialize(MCContext
&Ctx
, const TargetMachine
&TM
) {
23 Base::Initialize(Ctx
, TM
);
25 Ctx
.getELFSection(".progmem.data", ELF::SHT_PROGBITS
, ELF::SHF_ALLOC
);
29 AVRTargetObjectFile::SelectSectionForGlobal(const GlobalObject
*GO
,
31 const TargetMachine
&TM
) const {
32 // Global values in flash memory are placed in the progmem.data section
33 // unless they already have a user assigned section.
34 if (AVR::isProgramMemoryAddress(GO
) && !GO
->hasSection())
35 return ProgmemDataSection
;
37 // Otherwise, we work the same way as ELF.
38 return Base::SelectSectionForGlobal(GO
, Kind
, TM
);
40 } // end of namespace llvm