[PATCH] D26133: [ELF] Allow relative relocations to absolute symbols in PIC

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 07:21:30 PST 2017


Why is this correct? Testcase?

Cheers,
Rafael

Petr Hosek via Phabricator <reviews at reviews.llvm.org> writes:

> phosek updated this revision to Diff 87340.
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D26133
>
> Files:
>   ELF/Relocations.cpp
>
>
> Index: ELF/Relocations.cpp
> ===================================================================
> --- ELF/Relocations.cpp
> +++ ELF/Relocations.cpp
> @@ -351,6 +351,8 @@
>    // between start of a function and '_gp' value and defined as absolute just
>    // to simplify the code.
>    if (AbsVal && RelE) {
> +    if (Body.isLocal() || Body.getVisibility() == STV_HIDDEN)
> +      return true;
>      if (Body.isUndefined() && !Body.isLocal() && Body.symbol()->isWeak())
>        return true;
>      if (&Body == ElfSym<ELFT>::MipsGpDisp)
>
>
> Index: ELF/Relocations.cpp
> ===================================================================
> --- ELF/Relocations.cpp
> +++ ELF/Relocations.cpp
> @@ -351,6 +351,8 @@
>    // between start of a function and '_gp' value and defined as absolute just
>    // to simplify the code.
>    if (AbsVal && RelE) {
> +    if (Body.isLocal() || Body.getVisibility() == STV_HIDDEN)
> +      return true;
>      if (Body.isUndefined() && !Body.isLocal() && Body.symbol()->isWeak())
>        return true;
>      if (&Body == ElfSym<ELFT>::MipsGpDisp)


More information about the llvm-commits mailing list