[PATCH] D139097: [ARM] Fix Address value difference for symbol emitted by llvm-nm

Subham Kedia via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 1 05:12:47 PST 2022


quic-subhkedi updated this revision to Diff 479253.

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

https://reviews.llvm.org/D139097

Files:
  llvm/include/llvm/Object/ELFObjectFile.h
  llvm/test/tools/llvm-nm/ARM/address-check.test


Index: llvm/test/tools/llvm-nm/ARM/address-check.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-nm/ARM/address-check.test
@@ -0,0 +1,26 @@
+## Test for function type symbols with odd valued addresses have the correct
+## value on ARM.
+#
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-nm %t | FileCheck %s
+
+!ELF
+FileHeader:
+  Class:           ELFCLASS32
+  Data:            ELFDATA2LSB
+  Type:            ET_REL
+  Machine:         EM_ARM
+  Flags:           [ EF_ARM_EABI_VER5 ]
+Sections:
+  - Name:            .text
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+    AddressAlign:    0x4
+Symbols:
+  - Name:    foo
+    Value:   0x1003
+    Section: .text
+    Type:    STT_FUNC
+    Binding: STB_GLOBAL
+
+# CHECK: 00001003 T foo
Index: llvm/include/llvm/Object/ELFObjectFile.h
===================================================================
--- llvm/include/llvm/Object/ELFObjectFile.h
+++ llvm/include/llvm/Object/ELFObjectFile.h
@@ -558,8 +558,8 @@
     return Ret;
 
   const Elf_Ehdr &Header = EF.getHeader();
-  // Clear the ARM/Thumb or microMIPS indicator flag.
-  if ((Header.e_machine == ELF::EM_ARM || Header.e_machine == ELF::EM_MIPS) &&
+  // Clear the microMIPS indicator flag.
+  if ((Header.e_machine == ELF::EM_MIPS) &&
       (*SymOrErr)->getType() == ELF::STT_FUNC)
     Ret &= ~1;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139097.479253.patch
Type: text/x-patch
Size: 1414 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221201/1ecf106c/attachment.bin>


More information about the llvm-commits mailing list