<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/lld/test/ELF, branch main</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>ELF: Use index 0 for unversioned undefined symbols (#168189)</title>
<updated>2025-11-22T20:54:50+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2025-11-22T20:54:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d96a93ff00ac02bc523d36dd2e687d597a068ae1'/>
<id>d96a93ff00ac02bc523d36dd2e687d597a068ae1</id>
<content type='text'>
The GNU documentation is ambiguous about the version index for
unversioned undefined symbols. The current specification at
https://sourceware.org/gnu-gabi/program-loading-and-dynamic-linking.txt
defines VER_NDX_LOCAL (0) as "The symbol is private, and is not
available outside this object."

However, this naming is misleading for undefined symbols. As suggested
in
discussions, VER_NDX_LOCAL should conceptually be VER_NDX_NONE and apply
to unversioned undefined symbols as well.

GNU ld has used index 0 for unversioned undefined symbols both before
version 2.35 (see https://sourceware.org/PR26002) and in the upcoming
2.46 release (see https://sourceware.org/PR33577). This change aligns
with GNU ld's behavior by switching from index 1 to index 0.

While here, add a test to dso-undef-extract-lazy.s that undefined
symbols of index 0 in DSO are treated as unversioned symbols.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The GNU documentation is ambiguous about the version index for
unversioned undefined symbols. The current specification at
https://sourceware.org/gnu-gabi/program-loading-and-dynamic-linking.txt
defines VER_NDX_LOCAL (0) as "The symbol is private, and is not
available outside this object."

However, this naming is misleading for undefined symbols. As suggested
in
discussions, VER_NDX_LOCAL should conceptually be VER_NDX_NONE and apply
to unversioned undefined symbols as well.

GNU ld has used index 0 for unversioned undefined symbols both before
version 2.35 (see https://sourceware.org/PR26002) and in the upcoming
2.46 release (see https://sourceware.org/PR33577). This change aligns
with GNU ld's behavior by switching from index 1 to index 0.

While here, add a test to dso-undef-extract-lazy.s that undefined
symbols of index 0 in DSO are treated as unversioned symbols.</pre>
</div>
</content>
</entry>
<entry>
<title>ELF: Add support for relocating R_AARCH64_FUNCINIT64.</title>
<updated>2025-11-19T19:44:09+00:00</updated>
<author>
<name>Peter Collingbourne</name>
<email>pcc@google.com</email>
</author>
<published>2025-11-19T19:44:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=13e09ebe2dc7699598ac6eeb5fcb8738db27743b'/>
<id>13e09ebe2dc7699598ac6eeb5fcb8738db27743b</id>
<content type='text'>
R_AARCH64_FUNCINIT64 is a dynamic relocation type for relocating
word-sized data in the output file using the return value of
a function. An R_AARCH64_FUNCINIT64 shall be relocated as an
R_AARCH64_IRELATIVE with the target symbol address if the target
symbol is non-preemptible, and it shall be a usage error to relocate an
R_AARCH64_FUNCINIT64 with a preemptible or STT_GNU_IFUNC target symbol.

The initial use case for this relocation type shall be for emitting
global variable field initializers for structure protection. With
structure protection, the relocation value computation is tied to the
compiler implementation in such a way that it would not be reasonable to
define a relocation type for it (for example, it may involve computing
a hash using a compiler-determined algorithm), hence the need for the
computation to be implemented as code in the binary.

Part of the AArch64 psABI extension:
https://github.com/ARM-software/abi-aa/issues/340

Reviewers: smithp35, fmayer, MaskRay

Reviewed By: fmayer

Pull Request: https://github.com/llvm/llvm-project/pull/156564
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
R_AARCH64_FUNCINIT64 is a dynamic relocation type for relocating
word-sized data in the output file using the return value of
a function. An R_AARCH64_FUNCINIT64 shall be relocated as an
R_AARCH64_IRELATIVE with the target symbol address if the target
symbol is non-preemptible, and it shall be a usage error to relocate an
R_AARCH64_FUNCINIT64 with a preemptible or STT_GNU_IFUNC target symbol.

The initial use case for this relocation type shall be for emitting
global variable field initializers for structure protection. With
structure protection, the relocation value computation is tied to the
compiler implementation in such a way that it would not be reasonable to
define a relocation type for it (for example, it may involve computing
a hash using a compiler-determined algorithm), hence the need for the
computation to be implemented as code in the binary.

Part of the AArch64 psABI extension:
https://github.com/ARM-software/abi-aa/issues/340

Reviewers: smithp35, fmayer, MaskRay

Reviewed By: fmayer

Pull Request: https://github.com/llvm/llvm-project/pull/156564
</pre>
</div>
</content>
</entry>
<entry>
<title>ELF,test: Test unversioned undefined symbols of index 0 and 1</title>
<updated>2025-11-19T06:13:34+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2025-11-19T06:13:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ed1c8d7a57808de7ac60f2d0ff3e2b03a765cb7f'/>
<id>ed1c8d7a57808de7ac60f2d0ff3e2b03a765cb7f</id>
<content type='text'>
My 2020 change that added versioned symbol recognition
(reviews.llvm.org/D80059) checks both VER_NDX_LOCAL and VER_NDX_GLOBAL,
though test coverage was missing. lld/test/ELF/dso-undef-extract-lazy.s
checks that the undefined symbol is indeed considered unversioned.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
My 2020 change that added versioned symbol recognition
(reviews.llvm.org/D80059) checks both VER_NDX_LOCAL and VER_NDX_GLOBAL,
though test coverage was missing. lld/test/ELF/dso-undef-extract-lazy.s
checks that the undefined symbol is indeed considered unversioned.
</pre>
</div>
</content>
</entry>
<entry>
<title>[lld][test] Fix file cleanup in aarch64-build-attributes.s (#164396)</title>
<updated>2025-10-31T11:32:37+00:00</updated>
<author>
<name>David Spickett</name>
<email>david.spickett@linaro.org</email>
</author>
<published>2025-10-31T11:32:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a831c3fda76366ad8f1de502c05ee3ac719e0a83'/>
<id>a831c3fda76366ad8f1de502c05ee3ac719e0a83</id>
<content type='text'>
This test seems to have taken the lit documentation at its word:
https://llvm.org/docs/CommandGuide/lit.html#substitutions

"%t temporary file name unique to the test"

%t is in fact the **path** of a file. As suggested by the line below
that describing %basename_t.

This test (I assume) assumed it was just the filename itself and so left
a layout of:
```
$ tree tools/lld/test/
tools/lld/test/
├── CMakeFiles
├── ELF
│   └── Output
│       ├── aarch64-build-attributes.s.tmp
│       │   ├── pauth-bti-gcs.s
│       │   └── pauth-bti-pac.s
│       ├── aarch64-build-attributes.s.tmp.merged.o
│       ├── aarch64-build-attributes.s.tmp1.o
│       ├── aarch64-build-attributes.s.tmp2.o
│       └── aarch64-build-attributes.s.tmp3.o
├── Unit
│   └── lit.site.cfg.py
├── cmake_install.cmake
└── lit.site.cfg.py
```

Note how the 2 .s files are in the temp dir but the .o files are not.
This is fine, it works, but it's going to cost someone time to unpick
when this test actually does fail.

To fix this, remove %t from all the temp file names so they are created
in the temp dir, which is cleaned before each run.

New layout:
```
$ tree tools/lld/test/
tools/lld/test/
├── CMakeFiles
├── ELF
│   └── Output
│       └── aarch64-build-attributes.s.tmp
│           ├── 1.o
│           ├── 2.o
│           ├── 3.o
│           ├── merged.o
│           ├── pauth-bti-gcs.s
│           └── pauth-bti-pac.s
├── Unit
│   └── lit.site.cfg.py
├── cmake_install.cmake
└── lit.site.cfg.py
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This test seems to have taken the lit documentation at its word:
https://llvm.org/docs/CommandGuide/lit.html#substitutions

"%t temporary file name unique to the test"

%t is in fact the **path** of a file. As suggested by the line below
that describing %basename_t.

This test (I assume) assumed it was just the filename itself and so left
a layout of:
```
$ tree tools/lld/test/
tools/lld/test/
├── CMakeFiles
├── ELF
│   └── Output
│       ├── aarch64-build-attributes.s.tmp
│       │   ├── pauth-bti-gcs.s
│       │   └── pauth-bti-pac.s
│       ├── aarch64-build-attributes.s.tmp.merged.o
│       ├── aarch64-build-attributes.s.tmp1.o
│       ├── aarch64-build-attributes.s.tmp2.o
│       └── aarch64-build-attributes.s.tmp3.o
├── Unit
│   └── lit.site.cfg.py
├── cmake_install.cmake
└── lit.site.cfg.py
```

Note how the 2 .s files are in the temp dir but the .o files are not.
This is fine, it works, but it's going to cost someone time to unpick
when this test actually does fail.

To fix this, remove %t from all the temp file names so they are created
in the temp dir, which is cleaned before each run.

New layout:
```
$ tree tools/lld/test/
tools/lld/test/
├── CMakeFiles
├── ELF
│   └── Output
│       └── aarch64-build-attributes.s.tmp
│           ├── 1.o
│           ├── 2.o
│           ├── 3.o
│           ├── merged.o
│           ├── pauth-bti-gcs.s
│           └── pauth-bti-pac.s
├── Unit
│   └── lit.site.cfg.py
├── cmake_install.cmake
└── lit.site.cfg.py
```</pre>
</div>
</content>
</entry>
<entry>
<title>[lld][ARM] Don't emit veneers for wraparound branches. (#165263)</title>
<updated>2025-10-31T09:31:18+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>simon.tatham@arm.com</email>
</author>
<published>2025-10-31T09:31:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f2443861d7850279280457a6090039bcf8c60748'/>
<id>f2443861d7850279280457a6090039bcf8c60748</id>
<content type='text'>
If an instruction at the high end of the 32-bit address space branches
to one at the low end, then the branch can be within range for a B or BL
instruction, and doesn't need a veneer. `ARM::inBranchRange` was failing
to detect this because it calculated the offset as an int64_t, so that
the offset was a small value ± 2^32 instead of just the small value.

Fixes #165211.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If an instruction at the high end of the 32-bit address space branches
to one at the low end, then the branch can be within range for a B or BL
instruction, and doesn't need a veneer. `ARM::inBranchRange` was failing
to detect this because it calculated the offset as an int64_t, so that
the offset was a small value ± 2^32 instead of just the small value.

Fixes #165211.</pre>
</div>
</content>
</entry>
<entry>
<title>[lld] Fix RISCV vendor relocation testcase to require RISCV</title>
<updated>2025-10-24T11:50:54+00:00</updated>
<author>
<name>Owen Anderson</name>
<email>resistor@mac.com</email>
</author>
<published>2025-10-24T11:36:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9e7a3ee5ff85a6c6838b20734822d658744e9bf3'/>
<id>9e7a3ee5ff85a6c6838b20734822d658744e9bf3</id>
<content type='text'>
Fixes test issue introduced in 357b030f5e62a5891fd6120c02aa28d0874f0a06
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes test issue introduced in 357b030f5e62a5891fd6120c02aa28d0874f0a06
</pre>
</div>
</content>
</entry>
<entry>
<title>AMDGPU: Use ELF mangling in data layout (#163011)</title>
<updated>2025-10-13T03:01:45+00:00</updated>
<author>
<name>Matt Arsenault</name>
<email>Matthew.Arsenault@amd.com</email>
</author>
<published>2025-10-13T03:01:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=853760bca6aa7a960b154cef8c61f87271870b8a'/>
<id>853760bca6aa7a960b154cef8c61f87271870b8a</id>
<content type='text'>
Closes #95219</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Closes #95219</pre>
</div>
</content>
</entry>
<entry>
<title>ELF: Test .eh_frame relocation</title>
<updated>2025-09-28T17:15:08+00:00</updated>
<author>
<name>Fangrui Song</name>
<email>i@maskray.me</email>
</author>
<published>2025-09-28T17:15:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d30fe62cf15960b0b0b2c15d315fe51bb718822a'/>
<id>d30fe62cf15960b0b0b2c15d315fe51bb718822a</id>
<content type='text'>
EhInputSection currently uses scanSection path, getting ignored marker
relocations and undefined symbol diagnostics for free. This might change
in the future. Add test coverage.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
EhInputSection currently uses scanSection path, getting ignored marker
relocations and undefined symbol diagnostics for free. This might change
in the future. Add test coverage.
</pre>
</div>
</content>
</entry>
<entry>
<title>[lld][ELF] Fix gc-sections-print.s failure in read-only directories (#160204)</title>
<updated>2025-09-22T21:33:53+00:00</updated>
<author>
<name>Ivan Tadeu Ferreira Antunes Filho</name>
<email>antunesi@google.com</email>
</author>
<published>2025-09-22T21:33:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=61a535a2cdf4a28495a03d906cfb4250acbc7da7'/>
<id>61a535a2cdf4a28495a03d906cfb4250acbc7da7</id>
<content type='text'>
If ld.lld is invoked without the `-o` option, it defaults to writing its
output to `a.out` in the current directory. This can cause 'Permission
denied' errors if a test is executed in a directory without write
permissions, as can happen in some build environments.

Add `-o %t2` to this command, consistent with other commands in the same
test file, to prevent this failure by ensuring ld.lld writes to a
temporary file instead of `a.out`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If ld.lld is invoked without the `-o` option, it defaults to writing its
output to `a.out` in the current directory. This can cause 'Permission
denied' errors if a test is executed in a directory without write
permissions, as can happen in some build environments.

Add `-o %t2` to this command, consistent with other commands in the same
test file, to prevent this failure by ensuring ld.lld writes to a
temporary file instead of `a.out`.</pre>
</div>
</content>
</entry>
<entry>
<title>[ELF] -r/--emit-relocs: Fix crash when processing .rela.text before .text (#156354)</title>
<updated>2025-09-20T16:41:54+00:00</updated>
<author>
<name>mykouHW</name>
<email>koumeiyuan@huawei.com</email>
</author>
<published>2025-09-20T16:41:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=507f394d03d8cb24c90ae4b2d28e8afae3b4088d'/>
<id>507f394d03d8cb24c90ae4b2d28e8afae3b4088d</id>
<content type='text'>
fixes #156417 

When the relocation section is placed before the relocated section and
the relocated section is not defined in the linker script, an error will
occur during the linking process.

**Issue Cause:**  
In a.ro, `.rela.text` precedes its relocated `InputSection` `.text`.
`addOrphanSections` doesn't handle this scenario.
When it processes `.rela.text`, in the called `getOutputSectionName`,
`rel-&gt;getOutputSection()` is nullptr (input `.text` doesn't yet have a
parent output section), leading to an assertion failure.

**Solution:**  
For --emit-relocs and -r, ensure the output section for `.text.foo` is
created before the output section for `.rela.text.foo`.

---------

Co-authored-by: Fangrui Song &lt;i@maskray.me&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fixes #156417 

When the relocation section is placed before the relocated section and
the relocated section is not defined in the linker script, an error will
occur during the linking process.

**Issue Cause:**  
In a.ro, `.rela.text` precedes its relocated `InputSection` `.text`.
`addOrphanSections` doesn't handle this scenario.
When it processes `.rela.text`, in the called `getOutputSectionName`,
`rel-&gt;getOutputSection()` is nullptr (input `.text` doesn't yet have a
parent output section), leading to an assertion failure.

**Solution:**  
For --emit-relocs and -r, ensure the output section for `.text.foo` is
created before the output section for `.rela.text.foo`.

---------

Co-authored-by: Fangrui Song &lt;i@maskray.me&gt;</pre>
</div>
</content>
</entry>
</feed>
