diff options
author | Rui Ueyama <ruiu@google.com> | 2015-07-24 22:58:44 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2015-07-24 22:58:44 +0000 |
commit | 3cb895c9300817fe7a7ff1f1890639ba50e73c37 (patch) | |
tree | 13716c6185eaaec6d4f6f743be8f98c93eac765a /lld/COFF/DLL.cpp | |
parent | 67e5ba33e26d5c813faa9033a3d5ff684aa94ea2 (diff) | |
download | bcm5719-llvm-3cb895c9300817fe7a7ff1f1890639ba50e73c37.tar.gz bcm5719-llvm-3cb895c9300817fe7a7ff1f1890639ba50e73c37.zip |
COFF: Fix __ImageBase symbol relocation.
__ImageBase is a special symbol whose value is the image base address.
Previously, we handled __ImageBase symbol as an absolute symbol.
Absolute symbols point to specific locations in memory and the locations
never change even if an image is base-relocated. That means that we
don't have base relocation entries for absolute symbols.
This is not a case for __ImageBase. If an image is base-relocated, its
base address changes, and __ImageBase needs to be shifted as well.
So we have to have base relocations for __ImageBase. That means that
__ImageBase is not really an absolute symbol but a different kind of
symbol.
In this patch, I introduced a new type of symbol -- DefinedRelative.
DefinedRelative is similar to DefinedAbsolute, but it has not a VA but RVA
and is a subject of base relocation. Currently only __ImageBase is of
the new symbol type.
llvm-svn: 243176
Diffstat (limited to 'lld/COFF/DLL.cpp')
-rw-r--r-- | lld/COFF/DLL.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lld/COFF/DLL.cpp b/lld/COFF/DLL.cpp index 6a0e70a8750..68d35fc1d6f 100644 --- a/lld/COFF/DLL.cpp +++ b/lld/COFF/DLL.cpp @@ -319,7 +319,7 @@ public: write32le(Buf + FileOff + 13, Helper->getRVA() - RVA - 17); } - void getBaserels(std::vector<uint32_t> *Res, Defined *ImageBase) override { + void getBaserels(std::vector<uint32_t> *Res) override { Res->push_back(RVA + 3); Res->push_back(RVA + 8); } @@ -367,7 +367,7 @@ public: write64le(Buf + FileOff, Thunk->getRVA() + Config->ImageBase); } - void getBaserels(std::vector<uint32_t> *Res, Defined *ImageBase) override { + void getBaserels(std::vector<uint32_t> *Res) override { Res->push_back(RVA); } |