59 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8//9// This file contains the declaration of the BPFMCAsmInfo class.10//11//===----------------------------------------------------------------------===//12 13#ifndef LLVM_LIB_TARGET_BPF_MCTARGETDESC_BPFMCASMINFO_H14#define LLVM_LIB_TARGET_BPF_MCTARGETDESC_BPFMCASMINFO_H15 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 if (TT.getArch() == Triple::bpfeb)25 IsLittleEndian = false;26 27 PrivateGlobalPrefix = ".L";28 PrivateLabelPrefix = "L";29 WeakRefDirective = "\t.weak\t";30 31 UsesELFSectionDirectiveForBSS = true;32 HasSingleParameterDotFile = true;33 HasDotTypeDotSizeDirective = true;34 HasIdentDirective = false;35 36 SupportsDebugInformation = true;37 ExceptionsType = ExceptionHandling::DwarfCFI;38 MinInstAlignment = 8;39 40 // the default is 4 and it only affects dwarf elf output41 // so if not set correctly, the dwarf data will be42 // messed up in random places by 4 bytes. .debug_line43 // section will be parsable, but with odd offsets and44 // line numbers, etc.45 CodePointerSize = 8;46 }47 48 void setDwarfUsesRelocationsAcrossSections(bool enable) {49 DwarfUsesRelocationsAcrossSections = enable;50 }51 52 MCSection *getStackSection(MCContext &Ctx, bool Exec) const override {53 return nullptr;54 }55};56}57 58#endif59