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/MCAsmInfo.h" 17 #include "llvm/TargetParser/Triple.h" 18 19 namespace llvm { 20 21 class BPFMCAsmInfo : public MCAsmInfo { 22 public: 23 explicit BPFMCAsmInfo(const Triple &TT, const MCTargetOptions &Options) { 24 if (TT.getArch() == Triple::bpfeb) 25 IsLittleEndian = false; 26 27 PrivateGlobalPrefix = ".L"; 28 WeakRefDirective = "\t.weak\t"; 29 30 UsesELFSectionDirectiveForBSS = true; 31 HasSingleParameterDotFile = true; 32 HasDotTypeDotSizeDirective = true; 33 34 SupportsDebugInformation = true; 35 ExceptionsType = ExceptionHandling::DwarfCFI; 36 MinInstAlignment = 8; 37 38 // the default is 4 and it only affects dwarf elf output 39 // so if not set correctly, the dwarf data will be 40 // messed up in random places by 4 bytes. .debug_line 41 // section will be parsable, but with odd offsets and 42 // line numbers, etc. 43 CodePointerSize = 8; 44 } 45 46 void setDwarfUsesRelocationsAcrossSections(bool enable) { 47 DwarfUsesRelocationsAcrossSections = enable; 48 } 49 }; 50 } 51 52 #endif 53