[lld] r268070 - Fix the alignment of the version info.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 29 10:28:42 PDT 2016
Can you just set 16 and 32 instead of sizeof(ElfHalf) and sizeof(ElfWord)?
I don't really memorize these types.
On Fri, Apr 29, 2016 at 10:19 AM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: rafael
> Date: Fri Apr 29 12:19:45 2016
> New Revision: 268070
>
> URL: http://llvm.org/viewvc/llvm-project?rev=268070&view=rev
> Log:
> Fix the alignment of the version info.
>
> Modified:
> lld/trunk/ELF/OutputSections.cpp
> lld/trunk/test/ELF/verneed.s
>
> Modified: lld/trunk/ELF/OutputSections.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=268070&r1=268069&r2=268070&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/OutputSections.cpp (original)
> +++ lld/trunk/ELF/OutputSections.cpp Fri Apr 29 12:19:45 2016
> @@ -1521,7 +1521,9 @@ SymbolTableSection<ELFT>::getOutputSecti
>
> template <class ELFT>
> VersionTableSection<ELFT>::VersionTableSection()
> - : OutputSectionBase<ELFT>(".gnu.version", SHT_GNU_versym, SHF_ALLOC)
> {}
> + : OutputSectionBase<ELFT>(".gnu.version", SHT_GNU_versym, SHF_ALLOC) {
> + this->Header.sh_addralign = sizeof(typename ELFT::Half);
> +}
>
> template <class ELFT> void VersionTableSection<ELFT>::finalize() {
> this->Header.sh_size =
> @@ -1544,7 +1546,9 @@ template <class ELFT> void VersionTableS
>
> template <class ELFT>
> VersionNeedSection<ELFT>::VersionNeedSection()
> - : OutputSectionBase<ELFT>(".gnu.version_r", SHT_GNU_verneed,
> SHF_ALLOC) {}
> + : OutputSectionBase<ELFT>(".gnu.version_r", SHT_GNU_verneed,
> SHF_ALLOC) {
> + this->Header.sh_addralign = sizeof(typename ELFT::Word);
> +}
>
> template <class ELFT>
> void VersionNeedSection<ELFT>::addSymbol(SharedSymbol<ELFT> *SS) {
>
> Modified: lld/trunk/test/ELF/verneed.s
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/verneed.s?rev=268070&r1=268069&r2=268070&view=diff
>
> ==============================================================================
> --- lld/trunk/test/ELF/verneed.s (original)
> +++ lld/trunk/test/ELF/verneed.s Fri Apr 29 12:19:45 2016
> @@ -15,7 +15,7 @@
> # CHECK-NEXT: Size: 8
> # CHECK-NEXT: Link: 0
> # CHECK-NEXT: Info: 0
> -# CHECK-NEXT: AddressAlignment: 0
> +# CHECK-NEXT: AddressAlignment: 2
> # CHECK-NEXT: EntrySize: 2
> # CHECK-NEXT: }
> # CHECK-NEXT: Section {
> @@ -30,7 +30,7 @@
> # CHECK-NEXT: Size: 80
> # CHECK-NEXT: Link: 5
> # CHECK-NEXT: Info: 2
> -# CHECK-NEXT: AddressAlignment: 0
> +# CHECK-NEXT: AddressAlignment: 4
> # CHECK-NEXT: EntrySize: 0
> # CHECK-NEXT: }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160429/7591f029/attachment.html>
More information about the llvm-commits
mailing list