Skip to content

builtin.closure: improove ppc64le closure if PIE#26172

Merged
spytheman merged 1 commit into
vlang:masterfrom
tankf33der:ppc64le_r12
Dec 27, 2025
Merged

builtin.closure: improove ppc64le closure if PIE#26172
spytheman merged 1 commit into
vlang:masterfrom
tankf33der:ppc64le_r12

Conversation

@tankf33der

Copy link
Copy Markdown
Contributor

The lifetime of the ported ppc64le architecture in vlang is ~250 days.
All this time I remembered that closure crashes on debian13 (magic?).
When auditing inline assembler support, I ran into this crash again.
Debian13 - crashes, Almalinux9 - ok.

The issue turned out to be that Debian13 enabled PIE by default.
The compiled code relies on special register R12.

Picture below is PIE code. Right from the first lines the code relies on R12 and all calculations are based on it.
gdb-pie

No R12 register if -no-pie.
gdb-no-pie

I got access to such real hardware ppc64le with such Linux distributions:

CPU Distro
Power10 AlmaLinux 9.7
Power9 Debian 13.2
Power9 AlmaLinux 8.10
Power8 Centos 7

Only Debian13 do PIE by default in this list.

Now VTEST_ONLY=closure ./v test vlib works everywhere in my tests.
After the merge I will check all servers from scratch again because right now there's a mess there and everything is torn apart.

This issue cost me 40 hours.

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you a lot @tankf33der 🙇🏻 .

I am sorry about the time you lost debugging this.

On the bright side, you can think of it as saved time for everyone else that wanted to use V on that CPU, and for most people it would have been a lot longer, or even infinity.

@spytheman spytheman merged commit f68fa5f into vlang:master Dec 27, 2025
77 of 83 checks passed
@spytheman

Copy link
Copy Markdown
Contributor

(the CI failure is unrelated and fixed on master)

@tankf33der

Copy link
Copy Markdown
Contributor Author

VTEST_ONLY=closure ./v test vlib/

check report after merge:

Hardware CPU Distro
qemu Power10 AlmaLinux 10.1
real Power10 AlmaLinux 9.7
real Power9 Debian 13.2
real Power9 AlmaLinux 8.10
real Power8 Centos 7

All ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants