From 0314e1e1ef21112f22a8a7853666680e9a9846cf Mon Sep 17 00:00:00 2001 From: Frederic Riss Date: Mon, 1 Feb 2016 03:44:22 +0000 Subject: [PATCH] [dsymutil] Support scattered relocs. Although it seems like clang will never emit scattered relocations in the debug information (at least I couldn't find a way), we have too support them for the benefit of other compilers. As clang doesn't generate them, the included testcase was produced from hacked up assembly. llvm-svn: 259339 --- .../tools/dsymutil/ARM/dummy-debug-map.map | 15 ++ llvm/test/tools/dsymutil/ARM/scattered.c | 12 ++ .../tools/dsymutil/Inputs/scattered-reloc/1.o | Bin 0 -> 1528 bytes .../tools/dsymutil/Inputs/scattered-reloc/1.s | 186 ++++++++++++++++++ llvm/tools/dsymutil/DwarfLinker.cpp | 17 +- 5 files changed, 228 insertions(+), 2 deletions(-) create mode 100644 llvm/test/tools/dsymutil/ARM/dummy-debug-map.map create mode 100644 llvm/test/tools/dsymutil/ARM/scattered.c create mode 100644 llvm/test/tools/dsymutil/Inputs/scattered-reloc/1.o create mode 100644 llvm/test/tools/dsymutil/Inputs/scattered-reloc/1.s diff --git a/llvm/test/tools/dsymutil/ARM/dummy-debug-map.map b/llvm/test/tools/dsymutil/ARM/dummy-debug-map.map new file mode 100644 index 000000000000..aa69aeafedb1 --- /dev/null +++ b/llvm/test/tools/dsymutil/ARM/dummy-debug-map.map @@ -0,0 +1,15 @@ +# This is a dummy debug map used for some tests where the contents of the +# map are just an implementation detail. The tests wanting to use that file +# should put all there object files in an explicitely named sub-directory +# of Inputs, and they should be named 1.o, 2.o, ... +# As not finding an object file or symbols isn't a fatal error for dsymutil, +# you can extend this file with as much object files and symbols as needed. + +--- +triple: 'thumbv7-apple-darwin' +objects: + - filename: 1.o + symbols: + - { sym: _bar, objAddr: 0x0, binAddr: 0x10000, size: 0x10 } +... + diff --git a/llvm/test/tools/dsymutil/ARM/scattered.c b/llvm/test/tools/dsymutil/ARM/scattered.c new file mode 100644 index 000000000000..c84a602063f1 --- /dev/null +++ b/llvm/test/tools/dsymutil/ARM/scattered.c @@ -0,0 +1,12 @@ +RUN: llvm-dsymutil -y %p/dummy-debug-map.map -oso-prepend-path %p/../Inputs/scattered-reloc/ -f -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s + +// See Inputs/scattered-reloc/scattered.s to see how this test +// actually works. +int bar = 42; + +CHECK: DW_TAG_variable +CHECK-NOT: DW_TAG +CHECK: DW_AT_name{{.*}}"bar" +CHECK-NOT: DW_TAG +CHECK: DW_AT_location{{.*}}<0x05> 03 10 00 01 00 + diff --git a/llvm/test/tools/dsymutil/Inputs/scattered-reloc/1.o b/llvm/test/tools/dsymutil/Inputs/scattered-reloc/1.o new file mode 100644 index 0000000000000000000000000000000000000000..df5cc9bd3e0bc7e25f3cef8b29f52940cc82e8a8 GIT binary patch literal 1528 zcmbVM%Wl(95FN*HcsLD3Wr2i*45U(vP}DC?aP74afs!KCHw) z*6}{Z-XeJed0bCnpP1?9DHVCIqkfT6wXGMmzMsCaK4YEKS8B(O?9>xcYO`9a_Iy>L3S3 z;vXD#5HvjH+fB+C>E#1ryq9kibtD`uXD_~(td6g!F9TO_4jCIbj{zNl?PfU)G(wK8 zDLA4x!Ps6F!SM(j^@$wGoHpvdN3B^M0XR4xA183kV}F*#k|eRoi@*t7l*h0!MY-0M zyu=-DF9VvU89L8G=O4nr5N$uJZl_Ih