forked from OSchip/llvm-project
[ELF] Convert Thunks to use InputSectionDescriptions
Thunks are now generated per InputSectionDescription instead of per OutputSection. This allows created ThunkSections to be inserted directly into InputSectionDescription. Changes in this patch: - Loop over InputSectionDescriptions to find relocations to Thunks - Generate a ThunkSection per InputSectionDescription - Remove synchronize() as we no longer need it - Move fabricateDefaultCommands() before createThunks Differential Revision: https://reviews.llvm.org/D33835 llvm-svn: 304887
This commit is contained in:
parent
990c9cb2bf
commit
8e791463ef
|
@ -870,51 +870,6 @@ void LinkerScript::processNonSectionCommands() {
|
|||
}
|
||||
}
|
||||
|
||||
// Do a last effort at synchronizing the linker script "AST" and the section
|
||||
// list. This is needed to account for last minute changes, like adding a
|
||||
// .ARM.exidx terminator and sorting SHF_LINK_ORDER sections.
|
||||
//
|
||||
// FIXME: We should instead create the "AST" earlier and the above changes would
|
||||
// be done directly in the "AST".
|
||||
//
|
||||
// This can only handle new sections being added and sections being reordered.
|
||||
void LinkerScript::synchronize() {
|
||||
for (BaseCommand *Base : Opt.Commands) {
|
||||
auto *Cmd = dyn_cast<OutputSectionCommand>(Base);
|
||||
if (!Cmd)
|
||||
continue;
|
||||
ArrayRef<InputSection *> Sections = Cmd->Sec->Sections;
|
||||
std::vector<InputSection **> ScriptSections;
|
||||
DenseSet<InputSection *> ScriptSectionsSet;
|
||||
for (BaseCommand *Base : Cmd->Commands) {
|
||||
auto *ISD = dyn_cast<InputSectionDescription>(Base);
|
||||
if (!ISD)
|
||||
continue;
|
||||
for (InputSection *&IS : ISD->Sections) {
|
||||
if (IS->Live) {
|
||||
ScriptSections.push_back(&IS);
|
||||
ScriptSectionsSet.insert(IS);
|
||||
}
|
||||
}
|
||||
}
|
||||
std::vector<InputSection *> Missing;
|
||||
for (InputSection *IS : Sections)
|
||||
if (!ScriptSectionsSet.count(IS))
|
||||
Missing.push_back(IS);
|
||||
if (!Missing.empty()) {
|
||||
auto ISD = make<InputSectionDescription>("");
|
||||
ISD->Sections = Missing;
|
||||
Cmd->Commands.push_back(ISD);
|
||||
for (InputSection *&IS : ISD->Sections)
|
||||
if (IS->Live)
|
||||
ScriptSections.push_back(&IS);
|
||||
}
|
||||
assert(ScriptSections.size() == Sections.size());
|
||||
for (int I = 0, N = Sections.size(); I < N; ++I)
|
||||
*ScriptSections[I] = Sections[I];
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
allocateHeaders(std::vector<PhdrEntry> &Phdrs,
|
||||
ArrayRef<OutputSectionCommand *> OutputSectionCommands,
|
||||
|
|
|
@ -281,7 +281,6 @@ public:
|
|||
void assignOffsets(OutputSectionCommand *Cmd);
|
||||
void placeOrphanSections();
|
||||
void processNonSectionCommands();
|
||||
void synchronize();
|
||||
void assignAddresses(std::vector<PhdrEntry> &Phdrs,
|
||||
ArrayRef<OutputSectionCommand *> OutputSectionCommands);
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
#include "Relocations.h"
|
||||
#include "Config.h"
|
||||
#include "LinkerScript.h"
|
||||
#include "Memory.h"
|
||||
#include "OutputSections.h"
|
||||
#include "Strings.h"
|
||||
|
@ -995,13 +996,12 @@ void ThunkCreator::mergeThunks() {
|
|||
};
|
||||
std::merge(ISR->begin(), ISR->end(), Thunks.begin(), Thunks.end(),
|
||||
std::back_inserter(Tmp), MergeCmp);
|
||||
OutputSection *OS = Thunks.front()->getParent();
|
||||
OS->Sections = std::move(Tmp);
|
||||
OS->assignOffsets();
|
||||
*ISR = std::move(Tmp);
|
||||
}
|
||||
}
|
||||
|
||||
ThunkSection *ThunkCreator::getOSThunkSec(OutputSection *OS) {
|
||||
ThunkSection *ThunkCreator::getOSThunkSec(OutputSection *OS,
|
||||
std::vector<InputSection *> *ISR) {
|
||||
if (CurTS == nullptr) {
|
||||
uint32_t Off = 0;
|
||||
for (auto *IS : OS->Sections) {
|
||||
|
@ -1010,7 +1010,7 @@ ThunkSection *ThunkCreator::getOSThunkSec(OutputSection *OS) {
|
|||
break;
|
||||
}
|
||||
CurTS = make<ThunkSection>(OS, Off);
|
||||
ThunkSections[&OS->Sections].push_back(CurTS);
|
||||
ThunkSections[ISR].push_back(CurTS);
|
||||
}
|
||||
return CurTS;
|
||||
}
|
||||
|
@ -1021,7 +1021,21 @@ ThunkSection *ThunkCreator::getISThunkSec(InputSection *IS, OutputSection *OS) {
|
|||
return TS;
|
||||
auto *TOS = IS->getParent();
|
||||
TS = make<ThunkSection>(TOS, IS->OutSecOff);
|
||||
ThunkSections[&TOS->Sections].push_back(TS);
|
||||
|
||||
// Find InputSectionRange within TOS that IS is in
|
||||
OutputSectionCommand *C = Script->getCmd(TOS);
|
||||
std::vector<InputSection *> *Range = nullptr;
|
||||
for (BaseCommand *BC : C->Commands)
|
||||
if (auto *ISD = dyn_cast<InputSectionDescription> (BC)) {
|
||||
InputSection *first = ISD->Sections.front();
|
||||
InputSection *last = ISD->Sections.back();
|
||||
if (IS->OutSecOff >= first->OutSecOff &&
|
||||
IS->OutSecOff <= last->OutSecOff) {
|
||||
Range = &ISD->Sections;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ThunkSections[Range].push_back(TS);
|
||||
ThunkedSections[IS] = TS;
|
||||
return TS;
|
||||
}
|
||||
|
@ -1038,13 +1052,18 @@ std::pair<Thunk *, bool> ThunkCreator::getThunk(SymbolBody &Body,
|
|||
// InputSectionDescription::Sections.
|
||||
void ThunkCreator::forEachExecInputSection(
|
||||
ArrayRef<OutputSection *> OutputSections,
|
||||
std::function<void(OutputSection *, InputSection *)> Fn) {
|
||||
std::function<void(OutputSection *, std::vector<InputSection*> *,
|
||||
InputSection *)> Fn) {
|
||||
for (OutputSection *OS : OutputSections) {
|
||||
if (!(OS->Flags & SHF_ALLOC) || !(OS->Flags & SHF_EXECINSTR))
|
||||
continue;
|
||||
CurTS = nullptr;
|
||||
for (InputSection *IS : OS->Sections)
|
||||
Fn(OS, IS);
|
||||
if (OutputSectionCommand *C = Script->getCmd(OS))
|
||||
for (BaseCommand *BC : C->Commands)
|
||||
if (auto *ISD = dyn_cast<InputSectionDescription>(BC)) {
|
||||
CurTS = nullptr;
|
||||
for (InputSection* IS : ISD->Sections)
|
||||
Fn(OS, &ISD->Sections, IS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1066,7 +1085,8 @@ bool ThunkCreator::createThunks(ArrayRef<OutputSection *> OutputSections) {
|
|||
// ThunkSections back into the OutputSection as ThunkSections are not always
|
||||
// inserted into the same OutputSection as the caller.
|
||||
forEachExecInputSection(
|
||||
OutputSections, [=](OutputSection *OS, InputSection *IS) {
|
||||
OutputSections, [=](OutputSection *OS, std::vector<InputSection*> *ISR,
|
||||
InputSection *IS) {
|
||||
for (Relocation &Rel : IS->Relocations) {
|
||||
SymbolBody &Body = *Rel.Sym;
|
||||
if (!Target->needsThunk(Rel.Expr, Rel.Type, IS->File, Body))
|
||||
|
@ -1080,7 +1100,7 @@ bool ThunkCreator::createThunks(ArrayRef<OutputSection *> OutputSections) {
|
|||
if (auto *TIS = T->getTargetInputSection())
|
||||
TS = getISThunkSec(TIS, OS);
|
||||
else
|
||||
TS = getOSThunkSec(OS);
|
||||
TS = getOSThunkSec(OS, ISR);
|
||||
TS->addThunk(T);
|
||||
}
|
||||
// Redirect relocation to Thunk, we never go via the PLT to a Thunk
|
||||
|
|
|
@ -127,11 +127,13 @@ public:
|
|||
|
||||
private:
|
||||
void mergeThunks();
|
||||
ThunkSection *getOSThunkSec(OutputSection *OS);
|
||||
ThunkSection *getOSThunkSec(OutputSection *OS,
|
||||
std::vector<InputSection *> *ISR);
|
||||
ThunkSection *getISThunkSec(InputSection *IS, OutputSection *OS);
|
||||
void forEachExecInputSection(
|
||||
ArrayRef<OutputSection *> OutputSections,
|
||||
std::function<void(OutputSection *, InputSection *)> Fn);
|
||||
std::function<void(OutputSection *, std::vector<InputSection *> *,
|
||||
InputSection *)> Fn);
|
||||
std::pair<Thunk *, bool> getThunk(SymbolBody &Body, uint32_t Type);
|
||||
|
||||
// Track Symbols that already have a Thunk
|
||||
|
|
|
@ -1225,6 +1225,12 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
|
|||
if (SS->getParent() && !SS->empty())
|
||||
SS->getParent()->assignOffsets();
|
||||
|
||||
if (!Script->Opt.HasSections)
|
||||
Script->fabricateDefaultCommands();
|
||||
for (BaseCommand *Base : Script->Opt.Commands)
|
||||
if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base))
|
||||
OutputSectionCommands.push_back(Cmd);
|
||||
|
||||
// Dynamic section must be the last one in this list and dynamic
|
||||
// symbol table section (DynSymTab) must be the first one.
|
||||
applySynthetic({InX::DynSymTab, InX::Bss, InX::BssRelRo,
|
||||
|
@ -1253,13 +1259,6 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
|
|||
[](SyntheticSection *SS) { SS->updateAllocSize(); });
|
||||
}
|
||||
|
||||
if (!Script->Opt.HasSections)
|
||||
Script->fabricateDefaultCommands();
|
||||
else
|
||||
Script->synchronize();
|
||||
for (BaseCommand *Base : Script->Opt.Commands)
|
||||
if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base))
|
||||
OutputSectionCommands.push_back(Cmd);
|
||||
clearOutputSections();
|
||||
|
||||
// Fill other section headers. The dynamic table is finalized
|
||||
|
|
|
@ -0,0 +1,255 @@
|
|||
# REQUIRES: mips
|
||||
# Check LA25 stubs creation. This stub code is necessary when
|
||||
# non-PIC code calls PIC function.
|
||||
# RUN: echo "SECTIONS { .out 0x20000 : { *(.text.*) . = . + 0x100 ; *(.text) } }" > %t1.script
|
||||
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
|
||||
# RUN: %p/Inputs/mips-fpic.s -o %t-fpic.o
|
||||
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
|
||||
# RUN: %p/Inputs/mips-fnpic.s -o %t-fnpic.o
|
||||
# RUN: ld.lld -r %t-fpic.o %t-fnpic.o -o %t-sto-pic.o
|
||||
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
|
||||
# RUN: %p/Inputs/mips-pic.s -o %t-pic.o
|
||||
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t-npic.o
|
||||
# RUN: ld.lld --script %t1.script %t-npic.o %t-pic.o %t-sto-pic.o -o %t.exe
|
||||
# RUN: llvm-objdump -d %t.exe | FileCheck %s
|
||||
|
||||
# CHECK: Disassembly of section .out:
|
||||
# CHECK-NEXT: __LA25Thunk_foo1a:
|
||||
# CHECK-NEXT: 20000: 3c 19 00 02 lui $25, 2
|
||||
# CHECK-NEXT: 20004: 08 00 80 08 j 131104 <foo1a>
|
||||
# CHECK-NEXT: 20008: 27 39 00 20 addiu $25, $25, 32
|
||||
# CHECK-NEXT: 2000c: 00 00 00 00 nop
|
||||
# CHECK: __LA25Thunk_foo1b:
|
||||
# CHECK-NEXT: 20010: 3c 19 00 02 lui $25, 2
|
||||
# CHECK-NEXT: 20014: 08 00 80 09 j 131108 <foo1b>
|
||||
# CHECK-NEXT: 20018: 27 39 00 24 addiu $25, $25, 36
|
||||
# CHECK-NEXT: 2001c: 00 00 00 00 nop
|
||||
# CHECK: foo1a:
|
||||
# CHECK-NEXT: 20020: 00 00 00 00 nop
|
||||
# CHECK: foo1b:
|
||||
# CHECK-NEXT: 20024: 00 00 00 00 nop
|
||||
# CHECK: __LA25Thunk_foo2:
|
||||
# CHECK-NEXT: 20028: 3c 19 00 02 lui $25, 2
|
||||
# CHECK-NEXT: 2002c: 08 00 80 10 j 131136 <foo2>
|
||||
# CHECK-NEXT: 20030: 27 39 00 40 addiu $25, $25, 64
|
||||
# CHECK-NEXT: 20034: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20038: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2003c: 00 00 00 00 nop
|
||||
# CHECK: foo2:
|
||||
# CHECK-NEXT: 20040: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20044: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20048: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2004c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20050: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20054: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20058: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2005c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20060: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20064: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20068: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2006c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20070: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20074: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20078: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2007c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20080: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20084: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20088: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2008c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20090: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20094: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20098: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2009c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200a0: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200a4: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200a8: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200ac: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200b0: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200b4: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200b8: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200bc: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200c0: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200c4: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200c8: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200cc: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200d0: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200d4: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200d8: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200dc: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200e0: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200e4: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200e8: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200ec: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200f0: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200f4: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200f8: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 200fc: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20100: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20104: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20108: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2010c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20110: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20114: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20118: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2011c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20120: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20124: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20128: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2012c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20130: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20134: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20138: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2013c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20140: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20144: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20148: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2014c: 00 00 00 00 nop
|
||||
# CHECK: __start:
|
||||
# CHECK-NEXT: 20150: 0c 00 80 00 jal 131072 <__LA25Thunk_foo1a>
|
||||
# CHECK-NEXT: 20154: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20158: 0c 00 80 0a jal 131112 <__LA25Thunk_foo2>
|
||||
# CHECK-NEXT: 2015c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20160: 0c 00 80 04 jal 131088 <__LA25Thunk_foo1b>
|
||||
# CHECK-NEXT: 20164: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20168: 0c 00 80 0a jal 131112 <__LA25Thunk_foo2>
|
||||
# CHECK-NEXT: 2016c: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20170: 0c 00 80 60 jal 131456 <__LA25Thunk_fpic>
|
||||
# CHECK-NEXT: 20174: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20178: 0c 00 80 68 jal 131488 <fnpic>
|
||||
# CHECK-NEXT: 2017c: 00 00 00 00 nop
|
||||
# CHECK: __LA25Thunk_fpic:
|
||||
# CHECK-NEXT: 20180: 3c 19 00 02 lui $25, 2
|
||||
# CHECK-NEXT: 20184: 08 00 80 64 j 131472 <fpic>
|
||||
# CHECK-NEXT: 20188: 27 39 01 90 addiu $25, $25, 400
|
||||
# CHECK-NEXT: 2018c: 00 00 00 00 nop
|
||||
# CHECK: fpic:
|
||||
# CHECK-NEXT: 20190: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20194: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 20198: 00 00 00 00 nop
|
||||
# CHECK-NEXT: 2019c: 00 00 00 00 nop
|
||||
# CHECK: fnpic:
|
||||
# CHECK-NEXT: 201a0: 00 00 00 00 nop
|
||||
|
||||
.text
|
||||
.globl __start
|
||||
__start:
|
||||
jal foo1a
|
||||
jal foo2
|
||||
jal foo1b
|
||||
jal foo2
|
||||
jal fpic
|
||||
jal fnpic
|
||||
|
||||
# Test script with orphans added to existing OutputSection, the .text.1 and
|
||||
# .text.2 sections will be added to .text
|
||||
# RUN: echo "SECTIONS { .text 0x20000 : { *(.text) } }" > %t2.script
|
||||
# RUN: ld.lld --script %t2.script %t-npic.o %t-pic.o %t-sto-pic.o -o %t2.exe
|
||||
# RUN: llvm-objdump -d %t2.exe | FileCheck -check-prefix=ORPH1 %s
|
||||
# ORPH1: Disassembly of section .text:
|
||||
# ORPH1-NEXT: __start:
|
||||
# ORPH1-NEXT: 20000: 0c 00 80 15 jal 131156 <__LA25Thunk_foo1a>
|
||||
# ORPH1-NEXT: 20004: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 20008: 0c 00 80 22 jal 131208 <__LA25Thunk_foo2>
|
||||
# ORPH1-NEXT: 2000c: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 20010: 0c 00 80 19 jal 131172 <__LA25Thunk_foo1b>
|
||||
# ORPH1-NEXT: 20014: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 20018: 0c 00 80 22 jal 131208 <__LA25Thunk_foo2>
|
||||
# ORPH1-NEXT: 2001c: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 20020: 0c 00 80 0c jal 131120 <__LA25Thunk_fpic>
|
||||
# ORPH1-NEXT: 20024: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 20028: 0c 00 80 14 jal 131152 <fnpic>
|
||||
# ORPH1-NEXT: 2002c: 00 00 00 00 nop
|
||||
# ORPH1: __LA25Thunk_fpic:
|
||||
# ORPH1-NEXT: 20030: 3c 19 00 02 lui $25, 2
|
||||
# ORPH1-NEXT: 20034: 08 00 80 10 j 131136 <fpic>
|
||||
# ORPH1-NEXT: 20038: 27 39 00 40 addiu $25, $25, 64
|
||||
# ORPH1-NEXT: 2003c: 00 00 00 00 nop
|
||||
# ORPH1: fpic:
|
||||
# ORPH1-NEXT: 20040: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 20044: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 20048: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 2004c: 00 00 00 00 nop
|
||||
# ORPH1: fnpic:
|
||||
# ORPH1-NEXT: 20050: 00 00 00 00 nop
|
||||
# ORPH1: __LA25Thunk_foo1a:
|
||||
# ORPH1-NEXT: 20054: 3c 19 00 02 lui $25, 2
|
||||
# ORPH1-NEXT: 20058: 08 00 80 20 j 131200 <foo1a>
|
||||
# ORPH1-NEXT: 2005c: 27 39 00 80 addiu $25, $25, 128
|
||||
# ORPH1-NEXT: 20060: 00 00 00 00 nop
|
||||
# ORPH1: __LA25Thunk_foo1b:
|
||||
# ORPH1-NEXT: 20064: 3c 19 00 02 lui $25, 2
|
||||
# ORPH1-NEXT: 20068: 08 00 80 21 j 131204 <foo1b>
|
||||
# ORPH1-NEXT: 2006c: 27 39 00 84 addiu $25, $25, 132
|
||||
# ORPH1-NEXT: 20070: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 20074: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 20078: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 2007c: 00 00 00 00 nop
|
||||
# ORPH1: foo1a:
|
||||
# ORPH1-NEXT: 20080: 00 00 00 00 nop
|
||||
# ORPH1: foo1b:
|
||||
# ORPH1-NEXT: 20084: 00 00 00 00 nop
|
||||
# ORPH1: __LA25Thunk_foo2:
|
||||
# ORPH1-NEXT: 20088: 3c 19 00 02 lui $25, 2
|
||||
# ORPH1-NEXT: 2008c: 08 00 80 28 j 131232 <foo2>
|
||||
# ORPH1-NEXT: 20090: 27 39 00 a0 addiu $25, $25, 160
|
||||
# ORPH1-NEXT: 20094: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 20098: 00 00 00 00 nop
|
||||
# ORPH1-NEXT: 2009c: 00 00 00 00 nop
|
||||
# ORPH1: foo2:
|
||||
# ORPH1-NEXT: 200a0: 00 00 00 00 nop
|
||||
|
||||
# Test script with orphans added to new OutputSection, the .text.1 and
|
||||
# .text.2 sections will form a new OutputSection .text
|
||||
# RUN: echo "SECTIONS { .out 0x20000 : { *(.text) } }" > %t3.script
|
||||
# RUN: ld.lld --script %t3.script %t-npic.o %t-pic.o %t-sto-pic.o -o %t3.exe
|
||||
# RUN: llvm-objdump -d %t3.exe | FileCheck -check-prefix=ORPH2 %s
|
||||
# ORPH2: Disassembly of section .out:
|
||||
# ORPH2-NEXT: __start:
|
||||
# ORPH2-NEXT: 20000: 0c 00 80 18 jal 131168 <__LA25Thunk_foo1a>
|
||||
# ORPH2-NEXT: 20004: 00 00 00 00 nop
|
||||
# ORPH2-NEXT: 20008: 0c 00 80 22 jal 131208 <__LA25Thunk_foo2>
|
||||
# ORPH2-NEXT: 2000c: 00 00 00 00 nop
|
||||
# ORPH2-NEXT: 20010: 0c 00 80 1c jal 131184 <__LA25Thunk_foo1b>
|
||||
# ORPH2-NEXT: 20014: 00 00 00 00 nop
|
||||
# ORPH2-NEXT: 20018: 0c 00 80 22 jal 131208 <__LA25Thunk_foo2>
|
||||
# ORPH2-NEXT: 2001c: 00 00 00 00 nop
|
||||
# ORPH2-NEXT: 20020: 0c 00 80 0c jal 131120 <__LA25Thunk_fpic>
|
||||
# ORPH2-NEXT: 20024: 00 00 00 00 nop
|
||||
# ORPH2-NEXT: 20028: 0c 00 80 14 jal 131152 <fnpic>
|
||||
# ORPH2-NEXT: 2002c: 00 00 00 00 nop
|
||||
# ORPH2: __LA25Thunk_fpic:
|
||||
# ORPH2-NEXT: 20030: 3c 19 00 02 lui $25, 2
|
||||
# ORPH2-NEXT: 20034: 08 00 80 10 j 131136 <fpic>
|
||||
# ORPH2-NEXT: 20038: 27 39 00 40 addiu $25, $25, 64
|
||||
# ORPH2-NEXT: 2003c: 00 00 00 00 nop
|
||||
# ORPH2: fpic:
|
||||
# ORPH2-NEXT: 20040: 00 00 00 00 nop
|
||||
# ORPH2-NEXT: 20044: 00 00 00 00 nop
|
||||
# ORPH2-NEXT: 20048: 00 00 00 00 nop
|
||||
# ORPH2-NEXT: 2004c: 00 00 00 00 nop
|
||||
# ORPH2: fnpic:
|
||||
# ORPH2-NEXT: 20050: 00 00 00 00 nop
|
||||
# ORPH2-NEXT: Disassembly of section .text:
|
||||
# ORPH2-NEXT: __LA25Thunk_foo1a:
|
||||
# ORPH2-NEXT: 20060: 3c 19 00 02 lui $25, 2
|
||||
# ORPH2-NEXT: 20064: 08 00 80 20 j 131200 <foo1a>
|
||||
# ORPH2-NEXT: 20068: 27 39 00 80 addiu $25, $25, 128
|
||||
# ORPH2-NEXT: 2006c: 00 00 00 00 nop
|
||||
# ORPH2: __LA25Thunk_foo1b:
|
||||
# ORPH2-NEXT: 20070: 3c 19 00 02 lui $25, 2
|
||||
# ORPH2-NEXT: 20074: 08 00 80 21 j 131204 <foo1b>
|
||||
# ORPH2-NEXT: 20078: 27 39 00 84 addiu $25, $25, 132
|
||||
# ORPH2-NEXT: 2007c: 00 00 00 00 nop
|
||||
# ORPH2: foo1a:
|
||||
# ORPH2-NEXT: 20080: 00 00 00 00 nop
|
||||
# ORPH2: foo1b:
|
||||
# ORPH2-NEXT: 20084: 00 00 00 00 nop
|
||||
# ORPH2: __LA25Thunk_foo2:
|
||||
# ORPH2-NEXT: 20088: 3c 19 00 02 lui $25, 2
|
||||
# ORPH2-NEXT: 2008c: 08 00 80 28 j 131232 <foo2>
|
||||
# ORPH2-NEXT: 20090: 27 39 00 a0 addiu $25, $25, 160
|
||||
# ORPH2-NEXT: 20094: 00 00 00 00 nop
|
||||
# ORPH2-NEXT: 20098: 00 00 00 00 nop
|
||||
# ORPH2-NEXT: 2009c: 00 00 00 00 nop
|
||||
# ORPH2: foo2:
|
||||
# ORPH2-NEXT: 200a0: 00 00 00 00 nop
|
Loading…
Reference in New Issue