[PATCH] D18731: ELF: Create dynamic symbols for symbol aliases of copy relocations.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 4 14:16:56 PDT 2016
pcc added a comment.
Okay, I'll revert to the previous version.
================
Comment at: ELF/OutputSections.cpp:842
@@ -841,3 +841,3 @@
template <class ELFT> void OutputSection<ELFT>::assignOffsets() {
- uintX_t Off = 0;
+ uintX_t Off = this->Header.sh_size;
for (InputSection<ELFT> *S : Sections) {
----------------
This change moves copy relocation allocation from after offset assignment to before assignment. This function needs to take into account any space allocated that way.
================
Comment at: ELF/Writer.cpp:816
@@ -767,3 +815,3 @@
StringRef Dest = Script->getOutputSection<ELFT>(S);
if (!Dest.empty())
return Dest;
----------------
Yes, both symbols will be in the dynsym. I think we probably need to create dynsyms for all symbols at the same offset regardless of whether they are strong or weak, as otherwise the DSO will be able to observe breakage.
e.g. if the DSO looks like this:
```
int a;
__attribute__((weak, alias("a"))) int b;
bool f() {
return &a == &b;
}
```
the function f should return true regardless of which symbols are used in the main executable (if they're being overridden, that's another matter, though).
http://reviews.llvm.org/D18731
More information about the llvm-commits
mailing list