[llvm] r174874 - AArch64: Add basic relocation processing for llvm-dwarfdump.
Eric Christopher
echristo at gmail.com
Mon Feb 11 08:09:21 PST 2013
In this case you could use a .ll file to do this and just have it generated
rather than an object file that you check. Just compile a basic object file
with a function or two and it'll get you what you need. For the aarch64
bits go ahead and make a directory parallel to the X86 directory for this
specific thing.
Thanks!
-eric
On Mon, Feb 11, 2013 at 3:16 AM, Tim Northover <Tim.Northover at arm.com>wrote:
> Author: tnorthover
> Date: Mon Feb 11 05:16:02 2013
> New Revision: 174874
>
> URL: http://llvm.org/viewvc/llvm-project?rev=174874&view=rev
> Log:
> AArch64: Add basic relocation processing for llvm-dwarfdump.
>
> This allows llvm-dwarfdump to handle the relocations needed, at least
> for LLVM-produced code.
>
> Added:
> llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-aarch64 (with
> props)
> llvm/trunk/test/DebugInfo/dwarfdump-aarch64.test (with props)
> Modified:
> llvm/trunk/include/llvm/Object/RelocVisitor.h
>
> Modified: llvm/trunk/include/llvm/Object/RelocVisitor.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/RelocVisitor.h?rev=174874&r1=174873&r2=174874&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/RelocVisitor.h (original)
> +++ llvm/trunk/include/llvm/Object/RelocVisitor.h Mon Feb 11 05:16:02 2013
> @@ -92,6 +92,16 @@ public:
> HasError = true;
> return RelocToApply();
> }
> + } else if (FileFormat == "ELF64-aarch64") {
> + switch (RelocType) {
> + case llvm::ELF::R_AARCH64_ABS32:
> + return visitELF_AARCH64_ABS32(R, Value);
> + case llvm::ELF::R_AARCH64_ABS64:
> + return visitELF_AARCH64_ABS64(R, Value);
> + default:
> + HasError = true;
> + return RelocToApply();
> + }
> }
> HasError = true;
> return RelocToApply();
> @@ -172,6 +182,26 @@ private:
> uint32_t Res = (Value + Addend) & 0xFFFFFFFF;
> return RelocToApply(Res, 4);
> }
> +
> + // AArch64 ELF
> + RelocToApply visitELF_AARCH64_ABS32(RelocationRef R, uint64_t Value) {
> + int64_t Addend;
> + R.getAdditionalInfo(Addend);
> + int64_t Res = Value + Addend;
> +
> + // Overflow check allows for both signed and unsigned interpretation.
> + if (Res < INT32_MIN || Res > UINT32_MAX)
> + HasError = true;
> +
> + return RelocToApply(static_cast<uint32_t>(Res), 4);
> + }
> +
> + RelocToApply visitELF_AARCH64_ABS64(RelocationRef R, uint64_t Value) {
> + int64_t Addend;
> + R.getAdditionalInfo(Addend);
> + return RelocToApply(Value + Addend, 8);
> + }
> +
> };
>
> }
>
> Added: llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-aarch64
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-aarch64?rev=174874&view=auto
>
> ==============================================================================
> Binary files llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-aarch64
> (added) and llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-aarch64 Mon
> Feb 11 05:16:02 2013 differ
>
> Propchange: llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test.elf-aarch64
>
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Added: llvm/trunk/test/DebugInfo/dwarfdump-aarch64.test
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-aarch64.test?rev=174874&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/dwarfdump-aarch64.test (added)
> +++ llvm/trunk/test/DebugInfo/dwarfdump-aarch64.test Mon Feb 11 05:16:02
> 2013
> @@ -0,0 +1,16 @@
> +RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test.elf-aarch64 \
> +RUN: | FileCheck %s
> +
> +We're mostly checking that relocations are applied correctly
> +here. Currently R_AARCH64_ABS32 is used for references to debug data
> +and R_AARCH64_ABS64 is used for program addresses.
> +
> +A couple of ABS32s, both at 0 and elsewhere, interpreted correctly:
> +
> +CHECK: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang
> version 3.3 ")
> +CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000013] = "tmp.c")
> +
> +A couple of ABS64s similarly:
> +
> +CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
> +CHECK: DW_AT_high_pc [DW_FORM_addr] (0x000000000000005c)
>
> Propchange: llvm/trunk/test/DebugInfo/dwarfdump-aarch64.test
>
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
>
> _______________________________________________
> 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/20130211/690bb0a7/attachment.html>
More information about the llvm-commits
mailing list