1 //===-- M68kELFTargetObjectFile.cpp - M68k Object Files -----*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// This file contains definitions for M68k ELF object file lowering.
12 //===----------------------------------------------------------------------===//
14 #include "M68kTargetObjectFile.h"
16 #include "M68kSubtarget.h"
17 #include "M68kTargetMachine.h"
19 #include "llvm/BinaryFormat/ELF.h"
20 #include "llvm/IR/DataLayout.h"
21 #include "llvm/IR/DerivedTypes.h"
22 #include "llvm/IR/GlobalVariable.h"
23 #include "llvm/MC/MCContext.h"
24 #include "llvm/MC/MCSectionELF.h"
25 #include "llvm/Support/CommandLine.h"
26 #include "llvm/Target/TargetMachine.h"
30 static cl::opt
<unsigned> SSThreshold(
31 "m68k-ssection-threshold", cl::Hidden
,
32 cl::desc("Small data and bss section threshold size (default=8)"),
35 void M68kELFTargetObjectFile::Initialize(MCContext
&Ctx
,
36 const TargetMachine
&TM
) {
37 TargetLoweringObjectFileELF::Initialize(Ctx
, TM
);
38 InitializeELF(TM
.Options
.UseInitArray
);
40 this->TM
= &static_cast<const M68kTargetMachine
&>(TM
);
42 // FIXME do we need `.sdata` and `.sbss` explicitly?
43 SmallDataSection
= getContext().getELFSection(
44 ".sdata", ELF::SHT_PROGBITS
, ELF::SHF_WRITE
| ELF::SHF_ALLOC
);
46 SmallBSSSection
= getContext().getELFSection(".sbss", ELF::SHT_NOBITS
,
47 ELF::SHF_WRITE
| ELF::SHF_ALLOC
);