From 0743a72caac082e6fa4e12c4c830fcd1e09fae40 Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Thu, 6 Feb 2014 07:35:16 +0000 Subject: [PATCH] Accept and handle absolute symbols with empty name. llvm-svn: 200911 --- .../ReaderWriter/YAML/ReaderWriterYAML.cpp | 3 ++- lld/test/elf/abs-dup.objtxt | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 lld/test/elf/abs-dup.objtxt diff --git a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp index fab9e9100fcf..f5cb351e229d 100644 --- a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp +++ b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp @@ -96,7 +96,8 @@ public: buildDuplicateNameMap(*shlibAtom); } for (const lld::AbsoluteAtom *absAtom : file.absolute()) { - buildDuplicateNameMap(*absAtom); + if (!absAtom->name().empty()) + buildDuplicateNameMap(*absAtom); } } diff --git a/lld/test/elf/abs-dup.objtxt b/lld/test/elf/abs-dup.objtxt new file mode 100644 index 000000000000..7340a29b0f00 --- /dev/null +++ b/lld/test/elf/abs-dup.objtxt @@ -0,0 +1,19 @@ +# Tests handling an absolute symbol with no name +# RUN: lld -flavor gnu -target x86_64 -r %s \ +# RUN: --output-filetype=yaml | FileCheck %s + +absolute-atoms: + - name: abs + scope: static + value: 0x10 + - name: '' + scope: static + value: 0x15 + +# CHECK: absolute-atoms: +# CHECK: - name: abs +# CHECK: scope: static +# CHECK: value: 0x0000000000000010 +# CHECK: - name: '' +# CHECK: scope: static +# CHECK: value: 0x0000000000000015