CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
74 lines
2.9 KiB
C++
74 lines
2.9 KiB
C++
//===-- X86TargetObjectFile.cpp - X86 Object Info -------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "X86TargetObjectFile.h"
|
|
#include "MCTargetDesc/X86MCAsmInfo.h"
|
|
#include "llvm/BinaryFormat/Dwarf.h"
|
|
#include "llvm/MC/MCExpr.h"
|
|
#include "llvm/MC/MCValue.h"
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
using namespace llvm;
|
|
using namespace dwarf;
|
|
|
|
const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference(
|
|
const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,
|
|
MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
|
|
|
// On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which
|
|
// is an indirect pc-relative reference.
|
|
if ((Encoding & DW_EH_PE_indirect) && (Encoding & DW_EH_PE_pcrel)) {
|
|
const MCSymbol *Sym = TM.getSymbol(GV);
|
|
const MCExpr *Res =
|
|
MCSymbolRefExpr::create(Sym, X86::S_GOTPCREL, getContext());
|
|
const MCExpr *Four = MCConstantExpr::create(4, getContext());
|
|
return MCBinaryExpr::createAdd(Res, Four, getContext());
|
|
}
|
|
|
|
return TargetLoweringObjectFileMachO::getTTypeGlobalReference(
|
|
GV, Encoding, TM, MMI, Streamer);
|
|
}
|
|
|
|
MCSymbol *X86_64MachoTargetObjectFile::getCFIPersonalitySymbol(
|
|
const GlobalValue *GV, const TargetMachine &TM,
|
|
MachineModuleInfo *MMI) const {
|
|
return TM.getSymbol(GV);
|
|
}
|
|
|
|
const MCExpr *X86_64MachoTargetObjectFile::getIndirectSymViaGOTPCRel(
|
|
const GlobalValue *GV, const MCSymbol *Sym, const MCValue &MV,
|
|
int64_t Offset, MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
|
// On Darwin/X86-64, we need to use foo@GOTPCREL+4 to access the got entry
|
|
// from a data section. In case there's an additional offset, then use
|
|
// foo@GOTPCREL+4+<offset>.
|
|
unsigned FinalOff = Offset+MV.getConstant()+4;
|
|
const MCExpr *Res =
|
|
MCSymbolRefExpr::create(Sym, X86::S_GOTPCREL, getContext());
|
|
const MCExpr *Off = MCConstantExpr::create(FinalOff, getContext());
|
|
return MCBinaryExpr::createAdd(Res, Off, getContext());
|
|
}
|
|
|
|
X86ELFTargetObjectFile::X86ELFTargetObjectFile() {
|
|
PLTRelativeSpecifier = X86::S_PLT;
|
|
}
|
|
|
|
const MCExpr *X86ELFTargetObjectFile::getDebugThreadLocalSymbol(
|
|
const MCSymbol *Sym) const {
|
|
return MCSymbolRefExpr::create(Sym, X86::S_DTPOFF, getContext());
|
|
}
|
|
|
|
const MCExpr *X86_64ELFTargetObjectFile::getIndirectSymViaGOTPCRel(
|
|
const GlobalValue *GV, const MCSymbol *Sym, const MCValue &MV,
|
|
int64_t Offset, MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
|
int64_t FinalOffset = Offset + MV.getConstant();
|
|
const MCExpr *Res =
|
|
MCSymbolRefExpr::create(Sym, X86::S_GOTPCREL, getContext());
|
|
const MCExpr *Off = MCConstantExpr::create(FinalOffset, getContext());
|
|
return MCBinaryExpr::createAdd(Res, Off, getContext());
|
|
}
|