[llvm] r226932 - [Objdump] Output information about common symbols in a way closer to GNU objdump.
Colin LeMahieu
colinl at codeaurora.org
Fri Jan 23 12:06:24 PST 2015
Author: colinl
Date: Fri Jan 23 14:06:24 2015
New Revision: 226932
URL: http://llvm.org/viewvc/llvm-project?rev=226932&view=rev
Log:
[Objdump] Output information about common symbols in a way closer to GNU objdump.
Added:
llvm/trunk/test/tools/llvm-objdump/Inputs/common-symbol-elf (with props)
llvm/trunk/test/tools/llvm-objdump/common-symbol-elf.test
Modified:
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Added: llvm/trunk/test/tools/llvm-objdump/Inputs/common-symbol-elf
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/Inputs/common-symbol-elf?rev=226932&view=auto
==============================================================================
Binary file - no diff available.
Propchange: llvm/trunk/test/tools/llvm-objdump/Inputs/common-symbol-elf
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: llvm/trunk/test/tools/llvm-objdump/common-symbol-elf.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/common-symbol-elf.test?rev=226932&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/common-symbol-elf.test (added)
+++ llvm/trunk/test/tools/llvm-objdump/common-symbol-elf.test Fri Jan 23 14:06:24 2015
@@ -0,0 +1,3 @@
+// RUN: llvm-objdump -t %p/Inputs/common-symbol-elf | FileCheck %s
+
+CHECK: 00000400 g *COM* 00000008 common_symbol
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=226932&r1=226931&r2=226932&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Fri Jan 23 14:06:24 2015
@@ -642,7 +642,15 @@ void llvm::PrintSymbolTable(const Object
bool Global = Flags & SymbolRef::SF_Global;
bool Weak = Flags & SymbolRef::SF_Weak;
bool Absolute = Flags & SymbolRef::SF_Absolute;
+ bool Common = Flags & SymbolRef::SF_Common;
+ if (Common) {
+ uint32_t Alignment;
+ if (error(Symbol.getAlignment(Alignment)))
+ Alignment = 0;
+ Address = Size;
+ Size = Alignment;
+ }
if (Address == UnknownAddressOrSize)
Address = 0;
if (Size == UnknownAddressOrSize)
@@ -672,6 +680,8 @@ void llvm::PrintSymbolTable(const Object
<< ' ';
if (Absolute) {
outs() << "*ABS*";
+ } else if (Common) {
+ outs() << "*COM*";
} else if (Section == o->section_end()) {
outs() << "*UND*";
} else {
More information about the llvm-commits
mailing list