diff options
author | Rui Ueyama <ruiu@google.com> | 2015-07-24 23:24:45 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2015-07-24 23:24:45 +0000 |
commit | 2296dc137c07c09f058d7171de0ebdccdc330adb (patch) | |
tree | 3e90060526eda1f9e651bbf452852989b9f46e9d | |
parent | 3cb895c9300817fe7a7ff1f1890639ba50e73c37 (diff) | |
download | bcm5719-llvm-2296dc137c07c09f058d7171de0ebdccdc330adb.tar.gz bcm5719-llvm-2296dc137c07c09f058d7171de0ebdccdc330adb.zip |
COFF: Fix base relocation type for x86.
llvm-svn: 243178
-rw-r--r-- | lld/COFF/Chunks.cpp | 4 | ||||
-rw-r--r-- | lld/test/COFF/delayimports32.test | 20 | ||||
-rw-r--r-- | lld/test/COFF/hello32.test | 4 |
3 files changed, 15 insertions, 13 deletions
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp index 5017dbddc66..4f1ac166847 100644 --- a/lld/COFF/Chunks.cpp +++ b/lld/COFF/Chunks.cpp @@ -290,8 +290,10 @@ BaserelChunk::BaserelChunk(uint32_t Page, uint32_t *Begin, uint32_t *End) { write32le(P, Page); write32le(P + 4, Data.size()); P += 8; + uint16_t RelTy = + Config->is64() ? IMAGE_REL_BASED_DIR64 : IMAGE_REL_BASED_HIGHLOW; for (uint32_t *I = Begin; I != End; ++I) { - write16le(P, (IMAGE_REL_BASED_DIR64 << 12) | (*I - Page)); + write16le(P, (RelTy << 12) | (*I - Page)); P += 2; } } diff --git a/lld/test/COFF/delayimports32.test b/lld/test/COFF/delayimports32.test index 63ea8065202..8f50e927e54 100644 --- a/lld/test/COFF/delayimports32.test +++ b/lld/test/COFF/delayimports32.test @@ -29,43 +29,43 @@ IMPORT-NEXT: } BASEREL: BaseReloc [ BASEREL-NEXT: Entry { -BASEREL-NEXT: Type: DIR64 +BASEREL-NEXT: Type: HIGHLOW BASEREL-NEXT: Address: 0x1020 BASEREL-NEXT: } BASEREL-NEXT: Entry { -BASEREL-NEXT: Type: DIR64 +BASEREL-NEXT: Type: HIGHLOW BASEREL-NEXT: Address: 0x1028 BASEREL-NEXT: } BASEREL-NEXT: Entry { -BASEREL-NEXT: Type: DIR64 +BASEREL-NEXT: Type: HIGHLOW BASEREL-NEXT: Address: 0x2005 BASEREL-NEXT: } BASEREL-NEXT: Entry { -BASEREL-NEXT: Type: DIR64 +BASEREL-NEXT: Type: HIGHLOW BASEREL-NEXT: Address: 0x200C BASEREL-NEXT: } BASEREL-NEXT: Entry { -BASEREL-NEXT: Type: DIR64 +BASEREL-NEXT: Type: HIGHLOW BASEREL-NEXT: Address: 0x2022 BASEREL-NEXT: } BASEREL-NEXT: Entry { -BASEREL-NEXT: Type: DIR64 +BASEREL-NEXT: Type: HIGHLOW BASEREL-NEXT: Address: 0x2032 BASEREL-NEXT: } BASEREL-NEXT: Entry { -BASEREL-NEXT: Type: DIR64 +BASEREL-NEXT: Type: HIGHLOW BASEREL-NEXT: Address: 0x2039 BASEREL-NEXT: } BASEREL-NEXT: Entry { -BASEREL-NEXT: Type: DIR64 +BASEREL-NEXT: Type: HIGHLOW BASEREL-NEXT: Address: 0x203E BASEREL-NEXT: } BASEREL-NEXT: Entry { -BASEREL-NEXT: Type: DIR64 +BASEREL-NEXT: Type: HIGHLOW BASEREL-NEXT: Address: 0x204E BASEREL-NEXT: } BASEREL-NEXT: Entry { -BASEREL-NEXT: Type: DIR64 +BASEREL-NEXT: Type: HIGHLOW BASEREL-NEXT: Address: 0x2053 BASEREL-NEXT: } BASEREL-NEXT: ] diff --git a/lld/test/COFF/hello32.test b/lld/test/COFF/hello32.test index 130bb0ba784..52f6c7192b0 100644 --- a/lld/test/COFF/hello32.test +++ b/lld/test/COFF/hello32.test @@ -120,11 +120,11 @@ IMPORTS: } BASEREL: BaseReloc [ BASEREL: Entry { -BASEREL: Type: DIR64 +BASEREL: Type: HIGHLOW BASEREL: Address: 0x2005 BASEREL: } BASEREL: Entry { -BASEREL: Type: DIR64 +BASEREL: Type: HIGHLOW BASEREL: Address: 0x200C BASEREL: } BASEREL: ] |