[PATCH] D118526: [llvm-objcopy][MachO] Ignore LC_LINKER_OPTION when redefining symbols

Keith Smiley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 28 20:08:19 PST 2022


keith created this revision.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: rupprecht.
Herald added a reviewer: jhenderson.
Herald added a subscriber: abrachet.
keith requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

Previously you would get this error:

  error: unsupported load command (cmd=0x2d)

If the binary you were redefining the symbols of contained a
LC_LINKER_OPTION load command. This command does not need to be changed
when redefining symbols so we can ignore it like many others.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118526

Files:
  llvm/test/tools/llvm-objcopy/MachO/redefine-symbol.s
  llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp


Index: llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
===================================================================
--- llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
+++ llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
@@ -417,6 +417,7 @@
     case MachO::LC_SUB_UMBRELLA:
     case MachO::LC_SUB_CLIENT:
     case MachO::LC_SUB_LIBRARY:
+    case MachO::LC_LINKER_OPTION:
       // Nothing to update.
       break;
     default:
Index: llvm/test/tools/llvm-objcopy/MachO/redefine-symbol.s
===================================================================
--- llvm/test/tools/llvm-objcopy/MachO/redefine-symbol.s
+++ llvm/test/tools/llvm-objcopy/MachO/redefine-symbol.s
@@ -43,6 +43,7 @@
 # RUN: llvm-objcopy --strip-symbol _ba --redefine-sym _foo=_ba %t %t.noba
 # RUN: llvm-readobj --symbols %t.noba | FileCheck %s --check-prefix=NOTSTRIPPED
 
+.linker_option "-lc"
 .globl _func
 _func:
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118526.404222.patch
Type: text/x-patch
Size: 917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220129/15a2d45d/attachment-0001.bin>


More information about the llvm-commits mailing list