From 7a836ba3c5f2bdbd8b802a205f21b477ef91963d Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 28 Jan 2022 20:06:51 -0800 Subject: [PATCH] [llvm-objcopy][MachO] Ignore LC_LINKER_OPTION when redefining symbols 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. Differential Revision: https://reviews.llvm.org/D118526 --- llvm/test/tools/llvm-objcopy/MachO/redefine-symbol.s | 1 + llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/llvm/test/tools/llvm-objcopy/MachO/redefine-symbol.s b/llvm/test/tools/llvm-objcopy/MachO/redefine-symbol.s index 82d20ca..5919c93 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/redefine-symbol.s +++ b/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: diff --git a/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp b/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp index 3cac774..6b731ab 100644 --- a/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp +++ b/llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp @@ -417,6 +417,7 @@ Error MachOLayoutBuilder::layoutTail(uint64_t Offset) { 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: -- 2.7.4