1//===-- BPFMCAsmInfo.h - BPF asm properties -------------------*- C++ -*--====//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the declaration of the BPFMCAsmInfo class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_BPF_MCTARGETDESC_BPFMCASMINFO_H
14#define LLVM_LIB_TARGET_BPF_MCTARGETDESC_BPFMCASMINFO_H
15
16#include "llvm/MC/MCAsmInfoELF.h"
17#include "llvm/TargetParser/Triple.h"
18
19namespace llvm {
20
21class BPFMCAsmInfo : public MCAsmInfoELF {
22public:
23 explicit BPFMCAsmInfo(const Triple &TT, const MCTargetOptions &Options)
24 : MCAsmInfoELF(Options) {
25 if (TT.getArch() == Triple::bpfeb)
26 IsLittleEndian = false;
27
28 InternalSymbolPrefix = ".L";
29 WeakRefDirective = "\t.weak\t";
30
31 UsesELFSectionDirectiveForBSS = true;
32 HasSingleParameterDotFile = true;
33 HasDotTypeDotSizeDirective = true;
34 HasIdentDirective = false;
35
36 SupportsDebugInformation = true;
37 MinInstAlignment = 8;
38
39 // the default is 4 and it only affects dwarf elf output
40 // so if not set correctly, the dwarf data will be
41 // messed up in random places by 4 bytes. .debug_line
42 // section will be parsable, but with odd offsets and
43 // line numbers, etc.
44 CodePointerSize = 8;
45 }
46
47 void setDwarfUsesRelocationsAcrossSections(bool enable) {
48 DwarfUsesRelocationsAcrossSections = enable;
49 }
50
51 MCSection *getStackSection(MCContext &Ctx, bool Exec) const override {
52 return nullptr;
53 }
54};
55}
56
57#endif
58