[llvm] r230979 - [PS4] Correct relocation for DWARF TLS references.

Eric Christopher echristo at gmail.com
Mon Mar 2 10:28:46 PST 2015


On Mon, Mar 2, 2015 at 10:10 AM Robinson, Paul <
Paul_Robinson at playstation.sony.com> wrote:

>  There will be other, non-Linux-y things going into the PS4 TLOF later.
>
>
>
Let's burn that bridge when we come to it then.


>  Currently, no non-Linux ELF targets use DTPOFF for this.  I can easily
> believe that's a bug that nobody has noticed, but I have no way to
> test/prove that.
>
> If you think that behavioral change will be correct, I'm happy with moving
> the method specialization up into TargetLoweringObjectFileELF.
>
>
It will be correct for X86, but not necessarily aarch64 I think.

-eric


> --paulr
>
>
>
> *From:* Eric Christopher [mailto:echristo at gmail.com]
> *Sent:* Monday, March 02, 2015 9:53 AM
> *To:* Robinson, Paul; llvm-commits at cs.uiuc.edu
> *Subject:* Re: [llvm] r230979 - [PS4] Correct relocation for DWARF TLS
> references.
>
>
>
> Can you revert and/or explain this patch a bit more? Can you not just use
> the generic linux lowering since you've effectively just copied it exactly
> and did a s/X86LInux/PS4 on the code?
>
>
>
> I'm perfectly happy even doing a s/X86Linux/X86ELF if it'll make you
> happy, but not the code duplication.
>
>
>
> Thanks.
>
>
>
> -eric
>
>
>
> On Mon, Mar 2, 2015 at 9:49 AM Paul Robinson <
> paul_robinson at playstation.sony.com> wrote:
>
> Author: probinson
> Date: Mon Mar  2 11:44:52 2015
> New Revision: 230979
>
> URL: http://llvm.org/viewvc/llvm-project?rev=230979&view=rev
> Log:
> [PS4] Correct relocation for DWARF TLS references.
>
> Modified:
>     llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
>     llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
>     llvm/trunk/lib/Target/X86/X86TargetObjectFile.h
>     llvm/trunk/test/DebugInfo/X86/tls.ll
>
> Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=230979&r1=230978&r2=230979&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Mon Mar  2 11:44:52 2015
> @@ -37,6 +37,8 @@ static std::unique_ptr<TargetLoweringObj
>      return make_unique<TargetLoweringObjectFileMachO>();
>    }
>
> +  if (TT.isPS4CPU())
> +    return make_unique<PS4TargetObjectFile>();
>    if (TT.isOSLinux())
>      return make_unique<X86LinuxTargetObjectFile>();
>    if (TT.isOSBinFormatELF())
>
> Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=230979&r1=230978&r2=230979&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Mon Mar  2 11:44:52
> 2015
> @@ -74,6 +74,11 @@ X86LinuxTargetObjectFile::getDebugThread
>    return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF,
> getContext());
>  }
>
> +const MCExpr *PS4TargetObjectFile::getDebugThreadLocalSymbol(
> +    const MCSymbol *Sym) const {
> +  return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF,
> getContext());
> +}
> +
>  const MCExpr *X86WindowsTargetObjectFile::getExecutableRelativeSymbol(
>      const ConstantExpr *CE, Mangler &Mang, const TargetMachine &TM) const
> {
>    // We are looking for the difference of two symbols, need a subtraction
>
> Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.h?rev=230979&r1=230978&r2=230979&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86TargetObjectFile.h (original)
> +++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.h Mon Mar  2 11:44:52
> 2015
> @@ -47,6 +47,12 @@ namespace llvm {
>      const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const
> override;
>    };
>
> +  /// \brief This TLOF implementation is used for PS4.
> +  class PS4TargetObjectFile : public TargetLoweringObjectFileELF {
> +    /// \brief Describe a TLS variable address within debug info.
> +    const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const
> override;
> +  };
> +
>    /// \brief This implementation is used for Windows targets on x86 and
> x86-64.
>    class X86WindowsTargetObjectFile : public TargetLoweringObjectFileCOFF {
>      const MCExpr *
>
> Modified: llvm/trunk/test/DebugInfo/X86/tls.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/tls.ll?rev=230979&r1=230978&r2=230979&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/X86/tls.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/tls.ll Mon Mar  2 11:44:52 2015
> @@ -7,6 +7,9 @@
>  ; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-unknown-linux-gnu
> -split-dwarf=Enable \
>  ; RUN:   | FileCheck --check-prefix=CHECK --check-prefix=FISSION %s
>
> +; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-scei-ps4 \
> +; RUN:   | FileCheck --check-prefix=CHECK --check-prefix=SINGLE
> --check-prefix=SINGLE-64 %s
> +
>  ; FIXME: add relocation and DWARF expression support to llvm-dwarfdump &
> use
>  ; that here instead of raw assembly printing
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150302/28edcb0b/attachment.html>


More information about the llvm-commits mailing list