<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Object/MachOObjectFile.cpp, branch users/nico/python-2</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[MachO] Improve bounds check (#141083)</title>
<updated>2025-05-26T07:43:00+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2025-05-26T07:43:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3f29acb51739a3e6bfb8cc623eb37cb734c98a63'/>
<id>3f29acb51739a3e6bfb8cc623eb37cb734c98a63</id>
<content type='text'>
The current check may fail if the addition overflows. I've observed
failures of macho-invalid.test on 32-bit due to this.

Instead, compare against the remaining bytes until the end of the
object.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The current check may fail if the addition overflows. I've observed
failures of macho-invalid.test on 32-bit due to this.

Instead, compare against the remaining bytes until the end of the
object.</pre>
</div>
</content>
</entry>
<entry>
<title>[Support][Error] Add ErrorAsOutParameter constructor that takes an Error by ref.</title>
<updated>2024-11-29T04:57:53+00:00</updated>
<author>
<name>Lang Hames</name>
<email>lhames@gmail.com</email>
</author>
<published>2024-11-29T04:14:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d02c1676d75a6bab1252b48da9a955fc7dc1251f'/>
<id>d02c1676d75a6bab1252b48da9a955fc7dc1251f</id>
<content type='text'>
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&amp;
overload is more convenient.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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&amp;
overload is more convenient.
</pre>
</div>
</content>
</entry>
<entry>
<title>[LLVM] Use {} instead of std::nullopt to initialize empty ArrayRef (#109133)</title>
<updated>2024-09-19T15:16:38+00:00</updated>
<author>
<name>Jay Foad</name>
<email>jay.foad@amd.com</email>
</author>
<published>2024-09-19T15:16:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e03f427196ec67a8a5cfbdd658f9eabe9bce83ce'/>
<id>e03f427196ec67a8a5cfbdd658f9eabe9bce83ce</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm] Prefer StringRef::substr to StringRef::slice (NFC) (#106190)</title>
<updated>2024-08-27T13:46:20+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2024-08-27T13:46:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=71eebe9daaf5d2068606640a6040775020bc36e9'/>
<id>71eebe9daaf5d2068606640a6040775020bc36e9</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm] Prefer StringRef::substr to StringRef::slice (NFC) (#105943)</title>
<updated>2024-08-25T18:30:49+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2024-08-25T18:30:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=33e7cd6ff23f6c904314d17c68dc58168fd32d09'/>
<id>33e7cd6ff23f6c904314d17c68dc58168fd32d09</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>[AArch64][MachO] Add ptrauth ABI version to arm64e cpusubtype. (#104650)</title>
<updated>2024-08-20T18:37:12+00:00</updated>
<author>
<name>Ahmed Bougacha</name>
<email>ahmed@bougacha.org</email>
</author>
<published>2024-08-20T18:37:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=fd4f9520a6a08c3dcf15622e3b887d8f3624fc42'/>
<id>fd4f9520a6a08c3dcf15622e3b887d8f3624fc42</id>
<content type='text'>
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 &lt;francisvm@apple.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;francisvm@apple.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[AArch64][MachO] Encode @AUTH to ARM64_RELOC_AUTHENTICATED_POINTER.</title>
<updated>2024-08-16T18:59:27+00:00</updated>
<author>
<name>Ahmed Bougacha</name>
<email>ahmed@bougacha.org</email>
</author>
<published>2024-08-16T18:58:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=464fa3b3b047518699689b57c473c87701986593'/>
<id>464fa3b3b047518699689b57c473c87701986593</id>
<content type='text'>
This adds MachO support for emission of authenticated pointer
relocations.

We already support AArch64AuthMCExpr, to represent assembly expressions
such as:
  .quad &lt;symbol&gt;@AUTH(&lt;key&gt;, &lt;discriminator&gt; [, 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 |
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds MachO support for emission of authenticated pointer
relocations.

We already support AArch64AuthMCExpr, to represent assembly expressions
such as:
  .quad &lt;symbol&gt;@AUTH(&lt;key&gt;, &lt;discriminator&gt; [, 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 |
</pre>
</div>
</content>
</entry>
<entry>
<title>[MachO] Remove redundant bounds check (#100176)</title>
<updated>2024-08-01T17:14:11+00:00</updated>
<author>
<name>Daniel Bertalan</name>
<email>dani@danielbertalan.dev</email>
</author>
<published>2024-08-01T17:14:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7da1dbb632ca490c2ab3c2d6ff46cccda38c7acd'/>
<id>7da1dbb632ca490c2ab3c2d6ff46cccda38c7acd</id>
<content type='text'>
The condition was duplicated, the correct one for this message would
have been `ImportsEnd &gt; SymbolsEnd`. However, this is a subset of
`ImportEnd &gt; Symbols` (since `Symbols &lt;= 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</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The condition was duplicated, the correct one for this message would
have been `ImportsEnd &gt; SymbolsEnd`. However, this is a subset of
`ImportEnd &gt; Symbols` (since `Symbols &lt;= 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</pre>
</div>
</content>
</entry>
<entry>
<title>[MachO] Loosen boundary check for reading export trie nodes (#96705)</title>
<updated>2024-07-09T17:18:05+00:00</updated>
<author>
<name>Cyndy Ishida</name>
<email>cyndy_ishida@apple.com</email>
</author>
<published>2024-07-09T17:18:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cc945e41a7788327d0e8ba0ea6dc3571d7efa04f'/>
<id>cc945e41a7788327d0e8ba0ea6dc3571d7efa04f</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>[MachO] Stop parsing past end of rebase/bind table (#93897)</title>
<updated>2024-05-31T06:08:01+00:00</updated>
<author>
<name>Zixu Wang</name>
<email>9819235+zixu-w@users.noreply.github.com</email>
</author>
<published>2024-05-31T06:08:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1fa073ab896e65c55ff63487be0b41d7cea9aa77'/>
<id>1fa073ab896e65c55ff63487be0b41d7cea9aa77</id>
<content type='text'>
`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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`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.</pre>
</div>
</content>
</entry>
</feed>
