Skip to content

Commit 43b1334

Browse files
authored
[ELF] Add internal InputFile (#78944)
Based on https://reviews.llvm.org/D45375 . Introduce a new InputFile kind `InternalKind`, use it for * `ctx.internalFile`: for linker-defined symbols and some synthesized `Undefined` * `createInternalFile`: for symbol assignments and --defsym I picked "internal" instead of "synthetic" to avoid confusion with SyntheticSection. Currently a symbol's file is one of: nullptr, ObjKind, SharedKind, BitcodeKind, BinaryKind. Now it's non-null (I plan to add an `assert(file)` to Symbol::Symbol and change `toString(const InputFile *)` separately). Debugging and error reporting gets improved. The immediate user-facing difference is more descriptive "File" column in the --cref output. This patch may unlock further simplification. Currently each symbol assignment gets its own `createInternalFile(cmd->location)`. Two symbol assignments in a linker script do not share the same file. Making the file the same would be nice, but would require non trivial code.
1 parent a859df3 commit 43b1334

20 files changed

+75
-45
lines changed

lld/ELF/Arch/ARM.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,9 +1381,9 @@ template <typename ELFT> void elf::writeARMCmseImportLib() {
13811381
// Copy the secure gateway entry symbols to the import library symbol table.
13821382
for (auto &p : symtab.cmseSymMap) {
13831383
Defined *d = cast<Defined>(p.second.sym);
1384-
impSymTab->addSymbol(makeDefined(nullptr, d->getName(), d->computeBinding(),
1385-
/*stOther=*/0, STT_FUNC, d->getVA(),
1386-
d->getSize(), nullptr));
1384+
impSymTab->addSymbol(makeDefined(
1385+
ctx.internalFile, d->getName(), d->computeBinding(),
1386+
/*stOther=*/0, STT_FUNC, d->getVA(), d->getSize(), nullptr));
13871387
}
13881388

13891389
size_t idx = 0;

lld/ELF/Arch/Mips.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -771,12 +771,11 @@ template <class ELFT> bool elf::isMipsPIC(const Defined *sym) {
771771
if (!sym->section)
772772
return false;
773773

774-
ObjFile<ELFT> *file =
775-
cast<InputSectionBase>(sym->section)->template getFile<ELFT>();
776-
if (!file)
774+
InputFile *file = cast<InputSectionBase>(sym->section)->file;
775+
if (!file || file->isInternal())
777776
return false;
778777

779-
return file->getObj().getHeader().e_flags & EF_MIPS_PIC;
778+
return cast<ObjFile<ELFT>>(file)->getObj().getHeader().e_flags & EF_MIPS_PIC;
780779
}
781780

782781
template <class ELFT> TargetInfo *elf::getMipsTargetInfo() {

lld/ELF/Arch/PPC64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ static bool addOptional(StringRef name, uint64_t value,
253253
Symbol *sym = symtab.find(name);
254254
if (!sym || sym->isDefined())
255255
return false;
256-
sym->resolve(Defined{/*file=*/nullptr, StringRef(), STB_GLOBAL, STV_HIDDEN,
256+
sym->resolve(Defined{ctx.internalFile, StringRef(), STB_GLOBAL, STV_HIDDEN,
257257
STT_FUNC, value,
258258
/*size=*/0, /*section=*/nullptr});
259259
defined.push_back(cast<Defined>(sym));

lld/ELF/Config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ struct Ctx {
473473
std::pair<const InputFile *, const InputFile *>>
474474
backwardReferences;
475475
llvm::SmallSet<llvm::StringRef, 0> auxiliaryFiles;
476+
// InputFile for linker created symbols with no source location.
477+
InputFile *internalFile;
476478
// True if SHT_LLVM_SYMPART is used.
477479
std::atomic<bool> hasSympart{false};
478480
// True if there are TLS IE relocations. Set DF_STATIC_TLS if -shared.

lld/ELF/Driver.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ void Ctx::reset() {
105105
whyExtractRecords.clear();
106106
backwardReferences.clear();
107107
auxiliaryFiles.clear();
108+
internalFile = nullptr;
108109
hasSympart.store(false, std::memory_order_relaxed);
109110
hasTlsIe.store(false, std::memory_order_relaxed);
110111
needsTlsLd.store(false, std::memory_order_relaxed);
@@ -2337,7 +2338,8 @@ static void readSymbolPartitionSection(InputSectionBase *s) {
23372338

23382339
static Symbol *addUnusedUndefined(StringRef name,
23392340
uint8_t binding = STB_GLOBAL) {
2340-
return symtab.addSymbol(Undefined{nullptr, name, binding, STV_DEFAULT, 0});
2341+
return symtab.addSymbol(
2342+
Undefined{ctx.internalFile, name, binding, STV_DEFAULT, 0});
23412343
}
23422344

23432345
static void markBuffersAsDontNeed(bool skipLinkedOutput) {
@@ -2696,6 +2698,8 @@ void LinkerDriver::link(opt::InputArgList &args) {
26962698
for (auto *arg : args.filtered(OPT_trace_symbol))
26972699
symtab.insert(arg->getValue())->traced = true;
26982700

2701+
ctx.internalFile = createInternalFile("<internal>");
2702+
26992703
// Handle -u/--undefined before input files. If both a.a and b.so define foo,
27002704
// -u foo a.a b.so will extract a.a.
27012705
for (StringRef name : config->undefined)

lld/ELF/InputFiles.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,10 @@ void BinaryFile::parse() {
17851785
nullptr});
17861786
}
17871787

1788+
InputFile *elf::createInternalFile(StringRef name) {
1789+
return make<InputFile>(InputFile::InternalKind, MemoryBufferRef("", name));
1790+
}
1791+
17881792
ELFFileBase *elf::createObjFile(MemoryBufferRef mb, StringRef archiveName,
17891793
bool lazy) {
17901794
ELFFileBase *f;

lld/ELF/InputFiles.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ class InputFile {
6363
SharedKind,
6464
BitcodeKind,
6565
BinaryKind,
66+
InternalKind,
6667
};
6768

69+
InputFile(Kind k, MemoryBufferRef m);
6870
Kind kind() const { return fileKind; }
6971

7072
bool isElf() const {
7173
Kind k = kind();
7274
return k == ObjKind || k == SharedKind;
7375
}
76+
bool isInternal() const { return kind() == InternalKind; }
7477

7578
StringRef getName() const { return mb.getBufferIdentifier(); }
7679
MemoryBufferRef mb;
@@ -151,9 +154,6 @@ class InputFile {
151154
// R_PPC64_TLSLD. Disable TLS relaxation to avoid bad code generation.
152155
bool ppc64DisableTLSRelax = false;
153156

154-
protected:
155-
InputFile(Kind k, MemoryBufferRef m);
156-
157157
public:
158158
// If not empty, this stores the name of the archive containing this file.
159159
// We use this string for creating error messages.
@@ -380,6 +380,7 @@ class BinaryFile : public InputFile {
380380
void parse();
381381
};
382382

383+
InputFile *createInternalFile(StringRef name);
383384
ELFFileBase *createObjFile(MemoryBufferRef mb, StringRef archiveName = "",
384385
bool lazy = false);
385386

lld/ELF/InputSection.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ InputSection *InputSectionBase::getLinkOrderDep() const {
245245
// Find a symbol that encloses a given location.
246246
Defined *InputSectionBase::getEnclosingSymbol(uint64_t offset,
247247
uint8_t type) const {
248+
if (file->isInternal())
249+
return nullptr;
248250
for (Symbol *b : file->getSymbols())
249251
if (Defined *d = dyn_cast<Defined>(b))
250252
if (d->section == this && d->value <= offset &&
@@ -344,7 +346,7 @@ template <class ELFT> void InputSection::copyShtGroup(uint8_t *buf) {
344346
}
345347

346348
InputSectionBase *InputSection::getRelocatedSection() const {
347-
if (!file || (type != SHT_RELA && type != SHT_REL))
349+
if (!file || file->isInternal() || (type != SHT_RELA && type != SHT_REL))
348350
return nullptr;
349351
ArrayRef<InputSectionBase *> sections = file->getSections();
350352
return sections[info];

lld/ELF/InputSection.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLD_ELF_INPUT_SECTION_H
1010
#define LLD_ELF_INPUT_SECTION_H
1111

12+
#include "Config.h"
1213
#include "Relocations.h"
1314
#include "lld/Common/CommonLinkerContext.h"
1415
#include "lld/Common/LLVM.h"
@@ -413,7 +414,7 @@ class SyntheticSection : public InputSection {
413414
public:
414415
SyntheticSection(uint64_t flags, uint32_t type, uint32_t addralign,
415416
StringRef name)
416-
: InputSection(nullptr, flags, type, addralign, {}, name,
417+
: InputSection(ctx.internalFile, flags, type, addralign, {}, name,
417418
InputSectionBase::Synthetic) {}
418419

419420
virtual ~SyntheticSection() = default;

lld/ELF/LTO.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,12 @@ void BitcodeCompiler::add(BitcodeFile &f) {
256256
// Symbol section is always null for bitcode symbols, hence the check
257257
// for isElf(). Skip linker script defined symbols as well: they have
258258
// no File defined.
259-
!(dr->section == nullptr && (!sym->file || sym->file->isElf()));
259+
!(dr->section == nullptr &&
260+
(sym->file->isInternal() || sym->file->isElf()));
260261

261262
if (r.Prevailing)
262-
Undefined(nullptr, StringRef(), STB_GLOBAL, STV_DEFAULT, sym->type)
263+
Undefined(ctx.internalFile, StringRef(), STB_GLOBAL, STV_DEFAULT,
264+
sym->type)
263265
.overwrite(*sym);
264266

265267
// We tell LTO to not apply interprocedural optimization for wrapped

lld/ELF/LinkerScript.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ void LinkerScript::addSymbol(SymbolAssignment *cmd) {
233233
// write expressions like this: `alignment = 16; . = ALIGN(., alignment)`.
234234
uint64_t symValue = value.sec ? 0 : value.getValue();
235235

236-
Defined newSym(nullptr, cmd->name, STB_GLOBAL, visibility, value.type,
237-
symValue, 0, sec);
236+
Defined newSym(createInternalFile(cmd->location), cmd->name, STB_GLOBAL,
237+
visibility, value.type, symValue, 0, sec);
238238

239239
Symbol *sym = symtab.insert(cmd->name);
240240
sym->mergeProperties(newSym);
@@ -250,8 +250,8 @@ static void declareSymbol(SymbolAssignment *cmd) {
250250
return;
251251

252252
uint8_t visibility = cmd->hidden ? STV_HIDDEN : STV_DEFAULT;
253-
Defined newSym(nullptr, cmd->name, STB_GLOBAL, visibility, STT_NOTYPE, 0, 0,
254-
nullptr);
253+
Defined newSym(ctx.internalFile, cmd->name, STB_GLOBAL, visibility,
254+
STT_NOTYPE, 0, 0, nullptr);
255255

256256
// If the symbol is already defined, its order is 0 (with absence indicating
257257
// 0); otherwise it's assigned the order of the SymbolAssignment.

lld/ELF/Relocations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1757,7 +1757,7 @@ void elf::postScanRelocations() {
17571757

17581758
GotSection *got = in.got.get();
17591759
if (ctx.needsTlsLd.load(std::memory_order_relaxed) && got->addTlsIndex()) {
1760-
static Undefined dummy(nullptr, "", STB_LOCAL, 0, 0);
1760+
static Undefined dummy(ctx.internalFile, "", STB_LOCAL, 0, 0);
17611761
if (config->shared)
17621762
mainPart->relaDyn->addReloc(
17631763
{target->tlsModuleIndexRel, got, got->getTlsIndexOff()});

lld/ELF/ScriptLexer.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class ScriptLexer {
3232
void expect(StringRef expect);
3333
bool consumeLabel(StringRef tok);
3434
std::string getCurrentLocation();
35+
MemoryBufferRef getCurrentMB();
3536

3637
std::vector<MemoryBufferRef> mbs;
3738
std::vector<StringRef> tokens;
@@ -41,9 +42,6 @@ class ScriptLexer {
4142
size_t lastLineNumber = 0;
4243
size_t lastLineNumberOffset = 0;
4344

44-
protected:
45-
MemoryBufferRef getCurrentMB();
46-
4745
private:
4846
void maybeSplitExpr();
4947
StringRef getLine();

lld/ELF/ScriptParser.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ void ScriptParser::readDefsym(StringRef name) {
288288
Expr e = readExpr();
289289
if (!atEOF())
290290
setError("EOF expected, but got " + next());
291-
auto *cmd = make<SymbolAssignment>(name, e, 0, getCurrentLocation());
291+
auto *cmd = make<SymbolAssignment>(
292+
name, e, 0, getCurrentMB().getBufferIdentifier().str());
292293
script->sectionCommands.push_back(cmd);
293294
}
294295

lld/ELF/SyntheticSections.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ InputSection *elf::createInterpSection() {
261261
StringRef s = saver().save(config->dynamicLinker);
262262
ArrayRef<uint8_t> contents = {(const uint8_t *)s.data(), s.size() + 1};
263263

264-
return make<InputSection>(nullptr, SHF_ALLOC, SHT_PROGBITS, 1, contents,
265-
".interp");
264+
return make<InputSection>(ctx.internalFile, SHF_ALLOC, SHT_PROGBITS, 1,
265+
contents, ".interp");
266266
}
267267

268268
Defined *elf::addSyntheticLocal(StringRef name, uint8_t type, uint64_t value,

lld/ELF/Target.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ ErrorPlace elf::getErrorPlace(const uint8_t *loc) {
112112
std::string objLoc = isec->getLocation(loc - isecLoc);
113113
// Return object file location and source file location.
114114
// TODO: Refactor getSrcMsg not to take a variable.
115-
Undefined dummy(nullptr, "", STB_LOCAL, 0, 0);
115+
Undefined dummy(ctx.internalFile, "", STB_LOCAL, 0, 0);
116116
return {isec, objLoc + ": ",
117117
isec->file ? isec->getSrcMsg(dummy, loc - isecLoc) : ""};
118118
}

lld/ELF/Writer.cpp

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,23 +148,24 @@ static Defined *addOptionalRegular(StringRef name, SectionBase *sec,
148148
if (!s || s->isDefined() || s->isCommon())
149149
return nullptr;
150150

151-
s->resolve(Defined{nullptr, StringRef(), STB_GLOBAL, stOther, STT_NOTYPE, val,
151+
s->resolve(Defined{ctx.internalFile, StringRef(), STB_GLOBAL, stOther,
152+
STT_NOTYPE, val,
152153
/*size=*/0, sec});
153154
s->isUsedInRegularObj = true;
154155
return cast<Defined>(s);
155156
}
156157

157-
static Defined *addAbsolute(StringRef name) {
158-
Symbol *sym = symtab.addSymbol(Defined{nullptr, name, STB_GLOBAL, STV_HIDDEN,
159-
STT_NOTYPE, 0, 0, nullptr});
160-
sym->isUsedInRegularObj = true;
161-
return cast<Defined>(sym);
162-
}
163-
164158
// The linker is expected to define some symbols depending on
165159
// the linking result. This function defines such symbols.
166160
void elf::addReservedSymbols() {
167161
if (config->emachine == EM_MIPS) {
162+
auto addAbsolute = [](StringRef name) {
163+
Symbol *sym =
164+
symtab.addSymbol(Defined{ctx.internalFile, name, STB_GLOBAL,
165+
STV_HIDDEN, STT_NOTYPE, 0, 0, nullptr});
166+
sym->isUsedInRegularObj = true;
167+
return cast<Defined>(sym);
168+
};
168169
// Define _gp for MIPS. st_value of _gp symbol will be updated by Writer
169170
// so that it points to an absolute address which by default is relative
170171
// to GOT. Default offset is 0x7ff0.
@@ -213,7 +214,7 @@ void elf::addReservedSymbols() {
213214
if (config->emachine == EM_PPC64)
214215
gotOff = 0x8000;
215216

216-
s->resolve(Defined{/*file=*/nullptr, StringRef(), STB_GLOBAL, STV_HIDDEN,
217+
s->resolve(Defined{ctx.internalFile, StringRef(), STB_GLOBAL, STV_HIDDEN,
217218
STT_NOTYPE, gotOff, /*size=*/0, Out::elfHeader});
218219
ElfSym::globalOffsetTable = cast<Defined>(s);
219220
}
@@ -280,7 +281,8 @@ static void demoteSymbolsAndComputeIsPreemptible() {
280281
auto *s = dyn_cast<SharedSymbol>(sym);
281282
if (sym->isLazy() || (s && !cast<SharedFile>(s->file)->isNeeded)) {
282283
uint8_t binding = sym->isLazy() ? sym->binding : uint8_t(STB_WEAK);
283-
Undefined(nullptr, sym->getName(), binding, sym->stOther, sym->type)
284+
Undefined(ctx.internalFile, sym->getName(), binding, sym->stOther,
285+
sym->type)
284286
.overwrite(*sym);
285287
sym->versionId = VER_NDX_GLOBAL;
286288
}
@@ -1922,7 +1924,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
19221924
// https://sourceware.org/ml/binutils/2002-03/msg00360.html
19231925
if (mainPart->dynamic->parent) {
19241926
Symbol *s = symtab.addSymbol(Defined{
1925-
/*file=*/nullptr, "_DYNAMIC", STB_WEAK, STV_HIDDEN, STT_NOTYPE,
1927+
ctx.internalFile, "_DYNAMIC", STB_WEAK, STV_HIDDEN, STT_NOTYPE,
19261928
/*value=*/0, /*size=*/0, mainPart->dynamic.get()});
19271929
s->isUsedInRegularObj = true;
19281930
}
@@ -1964,7 +1966,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
19641966
// define _TLS_MODULE_BASE_ relative to the first TLS section.
19651967
Symbol *s = symtab.find("_TLS_MODULE_BASE_");
19661968
if (s && s->isUndefined()) {
1967-
s->resolve(Defined{/*file=*/nullptr, StringRef(), STB_GLOBAL,
1969+
s->resolve(Defined{ctx.internalFile, StringRef(), STB_GLOBAL,
19681970
STV_HIDDEN, STT_TLS, /*value=*/0, 0,
19691971
/*section=*/nullptr});
19701972
ElfSym::tlsModuleBase = cast<Defined>(s);
@@ -2106,8 +2108,9 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
21062108
// With the outputSections available check for GDPLT relocations
21072109
// and add __tls_get_addr symbol if needed.
21082110
if (config->emachine == EM_HEXAGON && hexagonNeedsTLSSymbol(outputSections)) {
2109-
Symbol *sym = symtab.addSymbol(Undefined{
2110-
nullptr, "__tls_get_addr", STB_GLOBAL, STV_DEFAULT, STT_NOTYPE});
2111+
Symbol *sym =
2112+
symtab.addSymbol(Undefined{ctx.internalFile, "__tls_get_addr",
2113+
STB_GLOBAL, STV_DEFAULT, STT_NOTYPE});
21112114
sym->isPreemptible = true;
21122115
partitions[0].dynSymTab->addSymbol(sym);
21132116
}

lld/test/ELF/cref.s

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
// RUN: echo '.global foo; foo:' | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t1.o
44
// RUN: echo '.global foo, bar; bar:' | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t2.o
55
// RUN: echo '.global zed; zed:' | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %ta.o
6+
// RUN: echo 'abs1 = 42;' > %t.lds
67
// RUN: rm -f %t.a
78
// RUN: llvm-ar rcs %t.a %ta.o
89
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t3.o
910
// RUN: ld.lld -shared -o %t1.so %t1.o
10-
// RUN: ld.lld -o /dev/null %t1.so %t2.o %t3.o %t.a --gc-sections --cref | FileCheck -strict-whitespace %s
11+
// RUN: ld.lld -o /dev/null %t1.so %t2.o %t3.o %t.a %t.a %t.lds --defsym abs2=43 --gc-sections --cref | FileCheck -strict-whitespace %s
1112

1213
/// If -Map is specified, print to the map file.
1314
// RUN: ld.lld -o /dev/null %t1.so %t2.o %t3.o %t.a --gc-sections -Map=%t.map --cref
@@ -26,6 +27,10 @@
2627
// CHECK-NEXT: baz {{.*}}3.o
2728
// CHECK-NEXT: zed {{.*}}.a({{.*}}a.o)
2829
// CHECK-NEXT: {{.*}}3.o
30+
// CHECK-NEXT: abs1 {{.*}}.lds:1
31+
// CHECK-NEXT: {{.*}}3.o
32+
// CHECK-NEXT: abs2 --defsym{{$}}
33+
// CHECK-NEXT: {{.*}}3.o
2934
// CHECK-NOT: discarded
3035

3136
// CHECK2: VMA LMA Size Align Out In Symbol
@@ -46,3 +51,7 @@ baz:
4651

4752
.section .text.a,"ax",@progbits
4853
discarded:
54+
55+
.data
56+
.quad abs1
57+
.quad abs2

lld/test/ELF/linkerscript/symbol-ordering-file2.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
# RUN: echo "SECTIONS { bar = 1; }" > %t.script
88
# RUN: ld.lld --symbol-ordering-file %t.ord %t.o --script %t.script \
99
# RUN: -o %t.out 2>&1 | FileCheck %s
10-
# CHECK: warning: <internal>: unable to order absolute symbol: bar
10+
# CHECK: warning: {{.*}}.script:1: unable to order absolute symbol: bar
1111

1212
## Check we do not crash when trying to order --defsym symbol.
1313

1414
# RUN: echo "bar" > %t.ord
1515
# RUN: ld.lld --symbol-ordering-file %t.ord %t.o -defsym=bar=1 \
16-
# RUN: -o %t.out 2>&1 | FileCheck %s
16+
# RUN: -o %t.out 2>&1 | FileCheck %s --check-prefix=DEFSYM
17+
# DEFSYM: warning: --defsym: unable to order absolute symbol: bar

lld/test/ELF/x86-64-gotpc-no-relax-err.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
## associated file or linker script line number).
99

1010
# CHECK: error: {{.*}}:(.text+0x2): relocation R_X86_64_GOTPCRELX out of range: 2147483658 is not in [-2147483648, 2147483647]; references '__stop_data'
11+
# CHECK-NEXT: >>> defined in <internal>
12+
# CHECK-EMPTY:
1113
# CHECK-NEXT: error: {{.*}}:(.text+0x9): relocation R_X86_64_REX_GOTPCRELX out of range: 2147483651 is not in [-2147483648, 2147483647]; references '__stop_data'
14+
# CHECK-NEXT: >>> defined in <internal>
1215

1316
#--- a.s
1417
movl __stop_data@GOTPCREL(%rip), %eax # out of range

0 commit comments

Comments
 (0)