[PATCH] D40826: [LLD] Use Rela on PowerPC too

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 23 15:26:02 PST 2018


LGTM.

Do you have commit access?

Thanks,
Rafael

Nicholas Allegra via Phabricator via llvm-commits
<llvm-commits at lists.llvm.org> writes:

> comex updated this revision to Diff 130799.
> comex added a comment.
> Herald added a subscriber: kbarton.
>
> Sorry for the delay; here's an updated diff with a test.  (The test didn't seem to clearly belong in any existing .s file I saw, so I just made a new one.)
>
>
> Repository:
>   rLLD LLVM Linker
>
> https://reviews.llvm.org/D40826
>
> Files:
>   ELF/Driver.cpp
>   test/ELF/ppc-rela.s
>
>
> Index: test/ELF/ppc-rela.s
> ===================================================================
> --- test/ELF/ppc-rela.s
> +++ test/ELF/ppc-rela.s
> @@ -0,0 +1,11 @@
> +# REQUIRES: ppc
> +# RUN: llvm-mc -filetype=obj -triple=powerpc-unknown-freebsd %s -o %t
> +# RUN: ld.lld %t -o %t2 -shared
> +# RUN: llvm-readobj -r %t2 | FileCheck %s
> +
> +.data
> +  .long foo
> +
> +// CHECK:      Section ({{.*}}) .rela.dyn {
> +// CHECK-NEXT:   0x1000 R_PPC_ADDR32 foo 0x0
> +// CHECK-NEXT: }
> Index: ELF/Driver.cpp
> ===================================================================
> --- ELF/Driver.cpp
> +++ ELF/Driver.cpp
> @@ -805,7 +805,8 @@
>    Config->Endianness =
>        Config->IsLE ? support::endianness::little : support::endianness::big;
>    Config->IsMips64EL = (Kind == ELF64LEKind && Machine == EM_MIPS);
> -  Config->IsRela = Config->Is64 || IsX32 || Config->MipsN32Abi;
> +  Config->IsRela = Config->Is64 || IsX32 || Config->MipsN32Abi ||
> +                   Machine == EM_PPC;
>    Config->Pic = Config->Pie || Config->Shared;
>    Config->Wordsize = Config->Is64 ? 8 : 4;
>  }
>
>
> Index: test/ELF/ppc-rela.s
> ===================================================================
> --- test/ELF/ppc-rela.s
> +++ test/ELF/ppc-rela.s
> @@ -0,0 +1,11 @@
> +# REQUIRES: ppc
> +# RUN: llvm-mc -filetype=obj -triple=powerpc-unknown-freebsd %s -o %t
> +# RUN: ld.lld %t -o %t2 -shared
> +# RUN: llvm-readobj -r %t2 | FileCheck %s
> +
> +.data
> +  .long foo
> +
> +// CHECK:      Section ({{.*}}) .rela.dyn {
> +// CHECK-NEXT:   0x1000 R_PPC_ADDR32 foo 0x0
> +// CHECK-NEXT: }
> Index: ELF/Driver.cpp
> ===================================================================
> --- ELF/Driver.cpp
> +++ ELF/Driver.cpp
> @@ -805,7 +805,8 @@
>    Config->Endianness =
>        Config->IsLE ? support::endianness::little : support::endianness::big;
>    Config->IsMips64EL = (Kind == ELF64LEKind && Machine == EM_MIPS);
> -  Config->IsRela = Config->Is64 || IsX32 || Config->MipsN32Abi;
> +  Config->IsRela = Config->Is64 || IsX32 || Config->MipsN32Abi ||
> +                   Machine == EM_PPC;
>    Config->Pic = Config->Pie || Config->Shared;
>    Config->Wordsize = Config->Is64 ? 8 : 4;
>  }
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list