[ELF] order rela.dyn/rela.plt properly

llvm-svn: 177969
This commit is contained in:
Shankar Easwaran 2013-03-26 02:20:08 +00:00
parent ce6392611b
commit 1af701ec6a
4 changed files with 41 additions and 2 deletions

View File

@ -259,7 +259,7 @@ public:
RelocationTable<ELFT> *getDynamicRelocationTable() {
if (!_dynamicRelocationTable) {
_dynamicRelocationTable.reset(new (_allocator) RelocationTable<ELFT>(
_targetInfo, ".rela.dyn", ORDER_REL));
_targetInfo, ".rela.dyn", ORDER_DYNAMIC_RELOCS));
addSection(_dynamicRelocationTable.get());
}
return _dynamicRelocationTable.get();
@ -269,7 +269,7 @@ public:
RelocationTable<ELFT> *getPLTRelocationTable() {
if (!_pltRelocationTable) {
_pltRelocationTable.reset(new (_allocator) RelocationTable<ELFT>(
_targetInfo, ".rela.plt", ORDER_REL));
_targetInfo, ".rela.plt", ORDER_DYNAMIC_PLT_RELOCS));
addSection(_pltRelocationTable.get());
}
return _pltRelocationTable.get();
@ -386,6 +386,8 @@ Layout::SegmentType DefaultLayout<ELFT>::getSegmentType(
case ORDER_HASH:
case ORDER_DYNAMIC_SYMBOLS:
case ORDER_DYNAMIC_STRINGS:
case ORDER_DYNAMIC_RELOCS:
case ORDER_DYNAMIC_PLT_RELOCS:
case ORDER_REL:
case ORDER_INIT:
case ORDER_PLT:
@ -429,6 +431,8 @@ bool DefaultLayout<ELFT>::hasOutputSegment(Section<ELFT> *section) {
case ORDER_HASH:
case ORDER_DYNAMIC_SYMBOLS:
case ORDER_DYNAMIC_STRINGS:
case ORDER_DYNAMIC_RELOCS:
case ORDER_DYNAMIC_PLT_RELOCS:
case ORDER_REL:
case ORDER_INIT:
case ORDER_PLT:

View File

@ -0,0 +1,26 @@
extern int shankar;
static int a;
static int b;
int c;
int fn2() {
return 0;
}
int fn1() {
return 0;
}
int fn() {
a = 10;
b = 20;
c = 10;
shankar = 20;
return 0;
}
int fn3() {
fn();
fn1();
fn2();
return 0;
}

Binary file not shown.

View File

@ -0,0 +1,9 @@
RUN: lld -core -target hexagon %p/Inputs/dynobj.o \
RUN: -output=%t -noinhibit-exec -output-type=shared
RUN: llvm-objdump -section-headers %t | FileCheck %s
CHECK: .dynsym
CHECK-NEXT: .dynstr
CHECK-NEXT: .rela.dyn
CHECK-NEXT: .rela.plt
CHECK-NEXT: .plt