diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-07-14 17:40:18 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-07-14 17:40:18 +0000 |
| commit | cafc0f2e03269e3d67da2535f8db188ba8363a16 (patch) | |
| tree | 2ffe928af365413c2e2f86309ce4ef49ee5687f6 | |
| parent | a6c7595d0fd94d6c0784d082eee28016f15c5940 (diff) | |
| download | bcm5719-llvm-cafc0f2e03269e3d67da2535f8db188ba8363a16.tar.gz bcm5719-llvm-cafc0f2e03269e3d67da2535f8db188ba8363a16.zip | |
Set DT_MIPS_BASE_ADDRESS correctly if -image-base is given.
Differential Revision: http://reviews.llvm.org/D22323
llvm-svn: 275446
| -rw-r--r-- | lld/ELF/OutputSections.cpp | 2 | ||||
| -rw-r--r-- | lld/test/ELF/mips-dynamic.s | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 56131d54102..7c94e84f648 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -724,7 +724,7 @@ template <class ELFT> void DynamicSection<ELFT>::finalize() { if (Config->EMachine == EM_MIPS) { Add({DT_MIPS_RLD_VERSION, 1}); Add({DT_MIPS_FLAGS, RHF_NOTPOT}); - Add({DT_MIPS_BASE_ADDRESS, (uintX_t)Target->getImageBase()}); + Add({DT_MIPS_BASE_ADDRESS, Config->ImageBase}); Add({DT_MIPS_SYMTABNO, Out<ELFT>::DynSymTab->getNumSymbols()}); Add({DT_MIPS_LOCAL_GOTNO, Out<ELFT>::Got->getMipsLocalEntriesNum()}); if (const SymbolBody *B = Out<ELFT>::Got->getMipsFirstGlobalEntry()) diff --git a/lld/test/ELF/mips-dynamic.s b/lld/test/ELF/mips-dynamic.s index cceaf6d0cbd..3cb5c63a49f 100644 --- a/lld/test/ELF/mips-dynamic.s +++ b/lld/test/ELF/mips-dynamic.s @@ -8,6 +8,10 @@ # RUN: llvm-readobj -sections -dynamic-table %t.exe \ # RUN: | FileCheck -check-prefix=EXE %s +# RUN: ld.lld %t.o --image-base=0x123000 %td.so -o %t.exe +# RUN: llvm-readobj -sections -dynamic-table %t.exe \ +# RUN: | FileCheck -check-prefix=IMAGE_BASE %s + # RUN: ld.lld -shared %t.o %td.so -o %t.so # RUN: llvm-readobj -sections -dyn-symbols -dynamic-table %t.so \ # RUN: | FileCheck -check-prefix=DSO %s @@ -45,13 +49,15 @@ # EXE-DAG: 0x00000003 PLTGOT [[GOTADDR]] # EXE-DAG: 0x70000001 MIPS_RLD_VERSION 1 # EXE-DAG: 0x70000005 MIPS_FLAGS NOTPOT -# EXE-DAG: 0x70000006 MIPS_BASE_ADDRESS +# EXE-DAG: 0x70000006 MIPS_BASE_ADDRESS 0x10000 # EXE-DAG: 0x7000000A MIPS_LOCAL_GOTNO 2 # EXE-DAG: 0x70000011 MIPS_SYMTABNO 2 # EXE-DAG: 0x70000013 MIPS_GOTSYM 0x2 # EXE-DAG: 0x70000016 MIPS_RLD_MAP [[RLDMAPADDR]] # EXE: ] +# IMAGE_BASE: 0x70000006 MIPS_BASE_ADDRESS 0x123000 + # DSO: Sections [ # DSO: Name: .dynamic # DSO-NEXT: Type: SHT_DYNAMIC |

