56 lines · cpp
1//===---------- ObjectFormats.cpp - Object format details for ORC ---------===//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// ORC-specific object format details.10//11//===----------------------------------------------------------------------===//12 13#include "llvm/ExecutionEngine/Orc/Shared/ObjectFormats.h"14#include "llvm/ADT/STLExtras.h"15 16namespace llvm {17namespace orc {18 19StringRef ELFEHFrameSectionName = ".eh_frame";20 21StringRef ELFInitArrayFuncSectionName = ".init_array";22StringRef ELFInitFuncSectionName = ".init";23StringRef ELFFiniArrayFuncSectionName = ".fini_array";24StringRef ELFFiniFuncSectionName = ".fini";25StringRef ELFCtorArrayFuncSectionName = ".ctors";26StringRef ELFDtorArrayFuncSectionName = ".dtors";27 28StringRef ELFInitSectionNames[3]{29 ELFInitArrayFuncSectionName,30 ELFInitFuncSectionName,31 ELFCtorArrayFuncSectionName,32};33 34StringRef ELFThreadBSSSectionName = ".tbss";35StringRef ELFThreadDataSectionName = ".tdata";36 37bool isMachOInitializerSection(StringRef QualifiedName) {38 return llvm::is_contained(MachOInitSectionNames, QualifiedName);39}40 41bool isELFInitializerSection(StringRef SecName) {42 for (StringRef InitSection : ELFInitSectionNames) {43 StringRef Name = SecName;44 if (Name.consume_front(InitSection) && (Name.empty() || Name[0] == '.'))45 return true;46 }47 return false;48}49 50bool isCOFFInitializerSection(StringRef SecName) {51 return SecName.starts_with(".CRT");52}53 54} // namespace orc55} // namespace llvm56