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/ADT/Triple.h" 17 #include "llvm/MC/MCAsmInfo.h" 18 19 namespace llvm { 20 class Target; 21 22 class BPFMCAsmInfo : public MCAsmInfo { 23 public: 24 explicit BPFMCAsmInfo(const Triple &TT, const MCTargetOptions &Options) { 25 if (TT.getArch() == Triple::bpfeb) 26 IsLittleEndian = false; 27 28 PrivateGlobalPrefix = ".L"; 29 WeakRefDirective = "\t.weak\t"; 30 31 UsesELFSectionDirectiveForBSS = true; 32 HasSingleParameterDotFile = true; 33 HasDotTypeDotSizeDirective = true; 34 35 SupportsDebugInformation = true; 36 ExceptionsType = ExceptionHandling::DwarfCFI; 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 } 52 53 #endif 54