[all-commits] [llvm/llvm-project] 9c97aa: [llvm-objcopy] Always update indirectsymoff in Mac...

Richard Dzenis via All-commits all-commits at lists.llvm.org
Fri Nov 29 02:27:33 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c97aa5abb6aa4ce4055095a89ae7d72e1b61803
      https://github.com/llvm/llvm-project/commit/9c97aa5abb6aa4ce4055095a89ae7d72e1b61803
  Author: Richard Dzenis <richard at dzenis.dev>
  Date:   2024-11-29 (Fri, 29 Nov 2024)

  Changed paths:
    M llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp
    A llvm/test/tools/llvm-objcopy/MachO/dysymtab-zero-indirectsym.test

  Log Message:
  -----------
  [llvm-objcopy] Always update indirectsymoff in MachO (#117726)

Let's say we've run llvm-strip over some MachO. The resulting MachO
became smaller and there are no indirect symbols anymore.

Then according to previous code we would not update indirectsymoff
field. This would lead to `MachOWriter::totalSize()` report size that is
larger than the new MachO. As a result we would get MachO that has zero
bytes past contents of the very last load command.

Codesign has a strict check that size of MachO file must be equal to

    lastLoadCommand.offset + lastLoadCommand.size

If this is not satisfied codesign reports the following error

    main executable failed strict validation

Fixes #117723



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list