diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-08-22 19:00:43 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-11-13 20:39:49 +0000 |
commit | fe6060f10f634930ff71b7c50291ddc610da2475 (patch) | |
tree | 1483580c790bd4d27b6500a7542b5ee00534d3cc /contrib/llvm-project/llvm/lib/Target/M68k/M68kTargetObjectFile.cpp | |
parent | b61bce17f346d79cecfd8f195a64b10f77be43b1 (diff) | |
parent | 344a3780b2e33f6ca763666c380202b18aab72a3 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/M68k/M68kTargetObjectFile.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Target/M68k/M68kTargetObjectFile.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/M68k/M68kTargetObjectFile.cpp b/contrib/llvm-project/llvm/lib/Target/M68k/M68kTargetObjectFile.cpp new file mode 100644 index 000000000000..3e26b37e7760 --- /dev/null +++ b/contrib/llvm-project/llvm/lib/Target/M68k/M68kTargetObjectFile.cpp @@ -0,0 +1,48 @@ +//===-- M68kELFTargetObjectFile.cpp - M68k Object Files -----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// This file contains definitions for M68k ELF object file lowering. +/// +//===----------------------------------------------------------------------===// + +#include "M68kTargetObjectFile.h" + +#include "M68kSubtarget.h" +#include "M68kTargetMachine.h" + +#include "llvm/BinaryFormat/ELF.h" +#include "llvm/IR/DataLayout.h" +#include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/GlobalVariable.h" +#include "llvm/MC/MCContext.h" +#include "llvm/MC/MCSectionELF.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Target/TargetMachine.h" + +using namespace llvm; + +static cl::opt<unsigned> SSThreshold( + "m68k-ssection-threshold", cl::Hidden, + cl::desc("Small data and bss section threshold size (default=8)"), + cl::init(8)); + +void M68kELFTargetObjectFile::Initialize(MCContext &Ctx, + const TargetMachine &TM) { + TargetLoweringObjectFileELF::Initialize(Ctx, TM); + InitializeELF(TM.Options.UseInitArray); + + this->TM = &static_cast<const M68kTargetMachine &>(TM); + + // FIXME do we need `.sdata` and `.sbss` explicitly? + SmallDataSection = getContext().getELFSection( + ".sdata", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC); + + SmallBSSSection = getContext().getELFSection(".sbss", ELF::SHT_NOBITS, + ELF::SHF_WRITE | ELF::SHF_ALLOC); +} |