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