[PATCH] D102776: [CG][X86][NFC] Add option to disable unconditional generation of PLT relocations for jmp/call
Evgeniy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 19 07:37:21 PDT 2021
ebrevnov created this revision.
Herald added subscribers: pengfei, hiraditya.
ebrevnov requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D102776
Files:
llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
Index: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
===================================================================
--- llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
+++ llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
@@ -24,6 +24,7 @@
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
@@ -34,6 +35,10 @@
#define DEBUG_TYPE "mccodeemitter"
+cl::opt<bool> DontGenPLTForDSOLocalCalls(
+ "dont-gen-plt-for-dsolocal-calls", cl::Hidden, cl::init(false),
+ cl::desc("Disables generation of PLT relocations for DSO local symbols"));
+
namespace {
class X86MCCodeEmitter : public MCCodeEmitter {
@@ -1464,6 +1469,15 @@
case X86II::RawFrm:
emitByte(BaseOpcode + OpcodeOffset, OS);
+ // Check if unconditional generation of PLT32 relocations for
+ // calls/jumps has been explicitly disabled. This may be useful for cases
+ // when nonstandard linker is used. For example, linking of JITed code is
+ // done in a special way and symbols exported by VM get linked only after
+ // PLT table has already been generated and it's too late to reduce PLT32
+ // relocations.
+ if (DontGenPLTForDSOLocalCalls)
+ break;
+
if (!STI.hasFeature(X86::Mode64Bit) || !isPCRel32Branch(MI, MCII))
break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102776.346456.patch
Type: text/x-patch
Size: 1464 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210519/3f07a0f5/attachment.bin>
More information about the llvm-commits
mailing list