History log of /llvm-project/llvm/lib/Object/MachOObjectFile.cpp (Results 1 – 25 of 491)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5
# d02c1676 29-Nov-2024 Lang Hames <lhames@gmail.com>

[Support][Error] Add ErrorAsOutParameter constructor that takes an Error by ref.

ErrorAsOutParameter's Error* constructor supports cases where an Error might not
be passed in (because in the calling

[Support][Error] Add ErrorAsOutParameter constructor that takes an Error by ref.

ErrorAsOutParameter's Error* constructor supports cases where an Error might not
be passed in (because in the calling context it's known that this call won't
fail). Most clients always have an Error present however, and for them an Error&
overload is more convenient.

show more ...


Revision tags: llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1
# e03f4271 19-Sep-2024 Jay Foad <jay.foad@amd.com>

[LLVM] Use {} instead of std::nullopt to initialize empty ArrayRef (#109133)

It is almost always simpler to use {} instead of std::nullopt to
initialize an empty ArrayRef. This patch changes all oc

[LLVM] Use {} instead of std::nullopt to initialize empty ArrayRef (#109133)

It is almost always simpler to use {} instead of std::nullopt to
initialize an empty ArrayRef. This patch changes all occurrences I could
find in LLVM itself. In future the ArrayRef(std::nullopt_t) constructor
could be deprecated or removed.

show more ...


Revision tags: llvmorg-19.1.0, llvmorg-19.1.0-rc4
# 71eebe9d 27-Aug-2024 Kazu Hirata <kazu@google.com>

[llvm] Prefer StringRef::substr to StringRef::slice (NFC) (#106190)

S.substr(N, M) is simpler than S.slice(N, N + M). Also, substr is
probably better recognizable than slice thanks to
std::string

[llvm] Prefer StringRef::substr to StringRef::slice (NFC) (#106190)

S.substr(N, M) is simpler than S.slice(N, N + M). Also, substr is
probably better recognizable than slice thanks to
std::string_view::substr.

show more ...


# 33e7cd6f 25-Aug-2024 Kazu Hirata <kazu@google.com>

[llvm] Prefer StringRef::substr to StringRef::slice (NFC) (#105943)

S.substr(N) is simpler than S.slice(N, StringRef::npos) and
S.slice(N, S.size()). Also, substr is probably better recognizable
t

[llvm] Prefer StringRef::substr to StringRef::slice (NFC) (#105943)

S.substr(N) is simpler than S.slice(N, StringRef::npos) and
S.slice(N, S.size()). Also, substr is probably better recognizable
than slice thanks to std::string_view::substr.

show more ...


# fd4f9520 20-Aug-2024 Ahmed Bougacha <ahmed@bougacha.org>

[AArch64][MachO] Add ptrauth ABI version to arm64e cpusubtype. (#104650)

In a mach_header, the cpusubtype is a 32-bit field, but it's split in 2
subfields:
- the low 24 bits containing the cpu sub

[AArch64][MachO] Add ptrauth ABI version to arm64e cpusubtype. (#104650)

In a mach_header, the cpusubtype is a 32-bit field, but it's split in 2
subfields:
- the low 24 bits containing the cpu subtype proper, (e.g.,
CPU_SUBTYPE_ARM64E 2)
- the high 8 bits containing a capability field used for additional
feature flags.

Notably, it's only the subtype subfield that participates in fat file
slice discrimination: the caps are ignored.

arm64e uses the caps subfield to encode a ptrauth ABI version:
- 0x80 (CPU_SUBTYPE_PTRAUTH_ABI) denotes a versioned binary
- 0x40 denotes a kernel-ABI binary
- 0x00-0x0F holds the ptrauth ABI version

This teaches the basic obj tools to decode that (or ignore it when
unneeded).

It also teaches the MachO writer to default to emitting versioned
binaries, but with a version of 0 (and without the kernel ABI flag).

Modern arm64e requires versioned binaries: a binary with 0x00 caps in
cpusubtype is now rejected by the linker and everything after. We can
live without the sophistication of specifying the version and kernel ABI
for now.

Co-authored-by: Francis Visoiu Mistrih <francisvm@apple.com>

show more ...


Revision tags: llvmorg-19.1.0-rc3
# 464fa3b3 16-Aug-2024 Ahmed Bougacha <ahmed@bougacha.org>

[AArch64][MachO] Encode @AUTH to ARM64_RELOC_AUTHENTICATED_POINTER.

This adds MachO support for emission of authenticated pointer
relocations.

We already support AArch64AuthMCExpr, to represent ass

[AArch64][MachO] Encode @AUTH to ARM64_RELOC_AUTHENTICATED_POINTER.

This adds MachO support for emission of authenticated pointer
relocations.

We already support AArch64AuthMCExpr, to represent assembly expressions
such as:
.quad <symbol>@AUTH(<key>, <discriminator> [, addr])
For example:
.quad _g3@AUTH(ib, 1234, addr)

These @AUTH expressions lower to a new kind of MachO relocation:
ARM64_RELOC_AUTHENTICATED_POINTER (11)

The relocation points to the referenced symbol.
The other data, describing the signing scheme and original addend
(only 32 bits instead of 64), is encoded into the addend (in the
relocated location):

|63|62|61-51|50-49| 48 |47 - 32|31 - 0|
| 1| 0| 0 | key | addr | discriminator | addend |

show more ...


Revision tags: llvmorg-19.1.0-rc2
# 7da1dbb6 01-Aug-2024 Daniel Bertalan <dani@danielbertalan.dev>

[MachO] Remove redundant bounds check (#100176)

The condition was duplicated, the correct one for this message would
have been `ImportsEnd > SymbolsEnd`. However, this is a subset of
`ImportEnd >

[MachO] Remove redundant bounds check (#100176)

The condition was duplicated, the correct one for this message would
have been `ImportsEnd > SymbolsEnd`. However, this is a subset of
`ImportEnd > Symbols` (since `Symbols <= SymbolsEnd`), so it can be
removed altogether.

I made this thinko in 686d8ce.

Note that that change wasn't intended to be permanent, and served as a
quick stopgap to facilitate testing chained fixups in LLD before Apple
upstreamed their implementation.

Fixes #90662
Fixes #87203

show more ...


Revision tags: llvmorg-19.1.0-rc1, llvmorg-20-init
# cc945e41 09-Jul-2024 Cyndy Ishida <cyndy_ishida@apple.com>

[MachO] Loosen boundary check for reading export trie nodes (#96705)

The design of the export trie in macho's is that each node has a
variable length payload. When reading nodes, it should be an er

[MachO] Loosen boundary check for reading export trie nodes (#96705)

The design of the export trie in macho's is that each node has a
variable length payload. When reading nodes, it should be an error if
reading the uleb128 puts you beyond the stated node size but not when
the stated size goes beyond the known part that was read.

resolves: rdar://130310832

This was primarily authored by Nick Kledzik, I added/cleaned up the test
cases.

show more ...


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7
# 1fa073ab 31-May-2024 Zixu Wang <9819235+zixu-w@users.noreply.github.com>

[MachO] Stop parsing past end of rebase/bind table (#93897)

`MachORebaseEntry::moveNext()` and `MachOBindEntry::moveNext()` assume
that the rebase/bind table ends with `{REBASE|BIND}_OPCODE_DONE` o

[MachO] Stop parsing past end of rebase/bind table (#93897)

`MachORebaseEntry::moveNext()` and `MachOBindEntry::moveNext()` assume
that the rebase/bind table ends with `{REBASE|BIND}_OPCODE_DONE` or an
actual rebase/bind. However a valid rebase/bind table might also end
with other effectively no-op opcodes, which caused the parser to move
past the end and go into the next table, resulting in corrupted entries
or infinite loops.

show more ...


Revision tags: llvmorg-18.1.6
# 14030d71 17-May-2024 Kazu Hirata <kazu@google.com>

[llvm] Drop explicit conversions of string literals to StringRef (NFC)

We routinely rely on implicit conversions of string literals to
StringRef so that we can use operator==(StringRef, StringRef).


# b910bebc 09-May-2024 Zixu Wang <9819235+zixu-w@users.noreply.github.com>

[llvm][MachO] Fix integer truncation in rebase/bind parsing (#89337)

`Count` and `Skip` should use `uint64_t` as they are encoded/decoded
using 64-bit ULEB128.

In `*_OPCODE_DO_*_ULEB_TIMES_SKIPP

[llvm][MachO] Fix integer truncation in rebase/bind parsing (#89337)

`Count` and `Skip` should use `uint64_t` as they are encoded/decoded
using 64-bit ULEB128.

In `*_OPCODE_DO_*_ULEB_TIMES_SKIPPING_ULEB`, `Skip` could be encoded as
a two's complement for moving `SegmentOffset` backwards. Having a 32-bit
`Skip` truncates the encoded value and leads to a malformed
`AdvanceAmount`
and invalid `SegmentOffset` that extends past valid sections.

show more ...


# bb6df080 08-May-2024 Kazu Hirata <kazu@google.com>

[llvm] Use StringRef::operator== instead of StringRef::equals (NFC) (#91441)

I'm planning to remove StringRef::equals in favor of
StringRef::operator==.

- StringRef::operator==/!= outnumber Stri

[llvm] Use StringRef::operator== instead of StringRef::equals (NFC) (#91441)

I'm planning to remove StringRef::equals in favor of
StringRef::operator==.

- StringRef::operator==/!= outnumber StringRef::equals by a factor of
70 under llvm/ in terms of their usage.

- The elimination of StringRef::equals brings StringRef closer to
std::string_view, which has operator== but not equals.

- S == "foo" is more readable than S.equals("foo"), especially for
!Long.Expression.equals("str") vs Long.Expression != "str".

show more ...


Revision tags: llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init
# 586ecdf2 12-Dec-2023 Kazu Hirata <kazu@google.com>

[llvm] Use StringRef::{starts,ends}_with (NFC) (#74956)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::

[llvm] Use StringRef::{starts,ends}_with (NFC) (#74956)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.

show more ...


Revision tags: llvmorg-17.0.6
# 2c071814 27-Nov-2023 Adrian Prantl <aprantl@apple.com>

[LEB128] Don't initialize error on success

This change removes an unnecessary branch from a hot path. It's also
questionable API to override any previous error unconditonally.


# 69b0cb9c 29-Nov-2023 Adrian Prantl <aprantl@apple.com>

Revert "[LEB128] Don't initialize error on success"

This reverts commit 545c8e009e2b649ef38f7e432ffbc06ba8a9b813.


# 545c8e00 27-Nov-2023 Adrian Prantl <aprantl@apple.com>

[LEB128] Don't initialize error on success

This change removes an unnecessary branch from a hot path. It's also
questionable API to override any previous error unconditonally.


Revision tags: llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4
# 282bf213 30-Aug-2023 Antonio Frighetto <me@antoniofrighetto.com>

[llvm-nm][MachO] Add support for `MH_FILESET`

Support printing of symbols for MachO of `MH_FILESET` type.
This is achieved by extending `dumpSymbolNamesFromObject`
to encompass fileset handling, and

[llvm-nm][MachO] Add support for `MH_FILESET`

Support printing of symbols for MachO of `MH_FILESET` type.
This is achieved by extending `dumpSymbolNamesFromObject`
to encompass fileset handling, and including an offset in
`MachOObjectFile` class to locate embedded MachO headers.

Differential Revision: https://reviews.llvm.org/D159294

show more ...


Revision tags: llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3
# d768bf99 10-Feb-2023 Archibald Elliott <archibald.elliott@arm.com>

[NFC][TargetParser] Replace uses of llvm/Support/Host.h

The forwarding header is left in place because of its use in
`polly/lib/External/isl/interface/extract_interface.cc`, but I have
added a GCC w

[NFC][TargetParser] Replace uses of llvm/Support/Host.h

The forwarding header is left in place because of its use in
`polly/lib/External/isl/interface/extract_interface.cc`, but I have
added a GCC warning about the fact it is deprecated, because it is used
in `isl` from where it is included by Polly.

show more ...


Revision tags: llvmorg-16.0.0-rc2
# 62c7f035 07-Feb-2023 Archibald Elliott <archibald.elliott@arm.com>

[NFC][TargetParser] Remove llvm/ADT/Triple.h

I also ran `git clang-format` to get the headers in the right order for
the new location, which has changed the order of other headers in two
files.


Revision tags: llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7
# 38818b60 04-Jan-2023 serge-sans-paille <sguelton@mozilla.com>

Move from llvm::makeArrayRef to ArrayRef deduction guides - llvm/ part

Use deduction guides instead of helper functions.

The only non-automatic changes have been:

1. ArrayRef(some_uint8_pointer, 0

Move from llvm::makeArrayRef to ArrayRef deduction guides - llvm/ part

Use deduction guides instead of helper functions.

The only non-automatic changes have been:

1. ArrayRef(some_uint8_pointer, 0) needs to be changed into ArrayRef(some_uint8_pointer, (size_t)0) to avoid an ambiguous call with ArrayRef((uint8_t*), (uint8_t*))
2. CVSymbol sym(makeArrayRef(symStorage)); needed to be rewritten as CVSymbol sym{ArrayRef(symStorage)}; otherwise the compiler is confused and thinks we have a (bad) function prototype. There was a few similar situation across the codebase.
3. ADL doesn't seem to work the same for deduction-guides and functions, so at some point the llvm namespace must be explicitly stated.
4. The "reference mode" of makeArrayRef(ArrayRef<T> &) that acts as no-op is not supported (a constructor cannot achieve that).

Per reviewers' comment, some useless makeArrayRef have been removed in the process.

This is a follow-up to https://reviews.llvm.org/D140896 that introduced
the deduction guides.

Differential Revision: https://reviews.llvm.org/D140955

show more ...


# ac20a3a5 13-Dec-2022 Cyndy Ishida <cyndy_ishida@apple.com>

[llvm][Object] set SF_Hidden flag for MachO files

Reviewed By: pete, ributzka

Differential Revision: https://reviews.llvm.org/D139862


# f7dffc28 10-Dec-2022 Kazu Hirata <kazu@google.com>

Don't include None.h (NFC)

I've converted all known uses of None to std::nullopt, so we no longer
need to include None.h.

This is part of an effort to migrate from llvm::Optional to
std::optional:

Don't include None.h (NFC)

I've converted all known uses of None to std::nullopt, so we no longer
need to include None.h.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

show more ...


# 3e5f54d6 09-Dec-2022 Guillaume Chatelet <gchatelet@google.com>

Revert D139098 "[Alignment] Use Align for ObjectFile::getSectionAlignment"

This breaks lld.

This reverts commit 10c47465e2505ddfee4e62a2ab2e535abea3ec56.


# 10c47465 01-Dec-2022 Guillaume Chatelet <gchatelet@google.com>

[Alignment] Use Align for ObjectFile::getSectionAlignment

Differential Revision: https://reviews.llvm.org/D139098


# 3c09ed00 05-Dec-2022 Kazu Hirata <kazu@google.com>

[llvm] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalu

[llvm] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

show more ...


12345678910>>...20