[PATCH] D60502: [llvm-nm] Add --special-syms

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 01:31:33 PDT 2019


evgeny777 updated this revision to Diff 197268.
evgeny777 added a comment.
Herald added a subscriber: javed.absar.

Ok, as far as I understood from ongoing discussion, we can first implement --special-syms as a dummy flag. That said, I'm updating the diff according to comments from @jhenderson


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60502/new/

https://reviews.llvm.org/D60502

Files:
  test/tools/llvm-nm/AArch64/special-syms.test
  tools/llvm-nm/llvm-nm.cpp


Index: tools/llvm-nm/llvm-nm.cpp
===================================================================
--- tools/llvm-nm/llvm-nm.cpp
+++ tools/llvm-nm/llvm-nm.cpp
@@ -180,6 +180,9 @@
 cl::alias JustSymbolNames("j", cl::desc("Alias for --just-symbol-name"),
                           cl::aliasopt(JustSymbolName), cl::Grouping);
 
+cl::opt<bool> SpecialSyms("special-syms",
+                          cl::desc("No-op. Used for GNU compatibility only"));
+
 // FIXME: This option takes exactly two strings and should be allowed anywhere
 // on the command line.  Such that "llvm-nm -s __TEXT __text foo.o" would work.
 // But that does not as the CommandLine Library does not have a way to make
Index: test/tools/llvm-nm/AArch64/special-syms.test
===================================================================
--- test/tools/llvm-nm/AArch64/special-syms.test
+++ test/tools/llvm-nm/AArch64/special-syms.test
@@ -0,0 +1,42 @@
+# RUN: yaml2obj %s > %t
+# Test --special-syms flag. Currently this flag is no-op, so outputs with and w/o
+# this flag should be identical. GNU nm doesn't show ARM and AArch64 special symbols
+# w/o --special-syms, so this test is to be changed when/if we decide to implement
+# GNU nm-like behavior in llvm-nm
+
+# RUN: llvm-nm %t | FileCheck %s
+# RUN: llvm-nm %t --special-syms | FileCheck %s
+
+!ELF
+FileHeader:
+  Class:           ELFCLASS64
+  Data:            ELFDATA2LSB
+  Type:            ET_REL
+  Machine:         EM_AARCH64
+Sections:
+  - Name:            .text
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+    Address:         0x1000
+    AddressAlign:    0x0000000000000010
+    Size:            64
+  - Name:            .data
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_WRITE ]
+    Address:         0x2000
+    AddressAlign:    0x0000000000000010
+    Size:            64
+Symbols:
+  - Name:     $x.1
+    Type:     STT_NOTYPE
+    Section:  .text
+    Value:    0
+    Size:     0
+  - Name:     $d.1
+    Type:     STT_NOTYPE
+    Size:     8
+    Section:  .data
+    Value:    0
+
+# CHECK:      2000 d $d.1
+# CHECK-NEXT: 1000 t $x.1


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60502.197268.patch
Type: text/x-patch
Size: 2160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190430/1fe90f03/attachment.bin>


More information about the llvm-commits mailing list