[all-commits] [llvm/llvm-project] 1a830a: [ObjCopy] Respect requirements of LC_ENCRYPTION_IN...

Daniel Rodríguez Troitiño via All-commits all-commits at lists.llvm.org
Wed Jan 8 08:49:25 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1a830aa1fe1e88749b563fefe18382842e0cff90
      https://github.com/llvm/llvm-project/commit/1a830aa1fe1e88749b563fefe18382842e0cff90
  Author: Daniel Rodríguez Troitiño <drodriguez at users.noreply.github.com>
  Date:   2025-01-08 (Wed, 08 Jan 2025)

  Changed paths:
    M llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp
    M llvm/lib/ObjCopy/MachO/MachOObject.cpp
    M llvm/lib/ObjCopy/MachO/MachOObject.h
    M llvm/lib/ObjCopy/MachO/MachOReader.cpp
    A llvm/test/tools/llvm-objcopy/MachO/strip-with-encryption-info.test

  Log Message:
  -----------
  [ObjCopy] Respect requirements of LC_ENCRYPTION_INFO commands (#120995)

LLD (and other Mach-O linkers) when preparing an encryptable binary make
space to leave all the load commands in an non-encrypted page (see [1])

When using objcopy of a small encryptable binary, the code was not
respecting this fact, and the encryptable segments were not kept beyond
the first page. This was obvious for small or empty binaries.

The changes introduced here keep track if a `LC_ENCRYPTION_INFO` or
`LC_ENCRYPTION_INFO_64` has been seen, and in such case, it adds a full
page of offset in order to leave the load commands in its own page
(similar to what LLD is doing).

[1]:
https://github.com/llvm/llvm-project/blob/d8e792931226b15d9d2424ecd24ccfe13adc2367/lld/MachO/SyntheticSections.cpp#L90-L93



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