Skip to content

fix(aarch64): shift immhi bits of ADRP to account for immlo#121

Merged
CensoredUsername merged 1 commit into
CensoredUsername:devfrom
Hackder:fix/adrp-not-encoded-properly
Feb 11, 2026
Merged

fix(aarch64): shift immhi bits of ADRP to account for immlo#121
CensoredUsername merged 1 commit into
CensoredUsername:devfrom
Hackder:fix/adrp-not-encoded-properly

Conversation

@Hackder

@Hackder Hackder commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

the immlo bits of the ADRP instruction on aarch64 must be shifted by 2, as the bottom two bits are stored in the immhi field. Similarly to how ADR works.

There is also blacklisted adrp within the testcase generator, I am not sure if it's because of this encoding issue or there was some other reason for it, probably worth a second look. (/tools/aarch64_emit_tests.py)
I couldn't get the test suite to regenerate on my mac easily, so I didn't check it.

the immlo bits of the ADRP instruction on aarch64 must be shifted
by 2, as the bottom two bits are stored in the immhi field.
Similarly to how ADR works.
@CensoredUsername

Copy link
Copy Markdown
Owner

Thanks! I'll take a look at it.

@CensoredUsername

Copy link
Copy Markdown
Owner

Looks correct, this also matches how the runtime processes ADRP relocations. Not sure what happened here. The blacklisted test is because the assembler I was using at the time as reference didn't like getting an immediate as the argument for ADRP so I couldn't validate it. Unfortunate that an error snuck in there.

I'll rebase this to dev once I'm done with the relocation rework.

@Hackder

Hackder commented Feb 8, 2026

Copy link
Copy Markdown
Contributor Author

Awesome, thanks. Happy to contribute

@CensoredUsername CensoredUsername changed the base branch from master to dev February 11, 2026 16:53
@CensoredUsername CensoredUsername merged commit 1b95230 into CensoredUsername:dev Feb 11, 2026
1 check passed
@CensoredUsername

Copy link
Copy Markdown
Owner

The changes are live now in v5.0.0, thanks for the contribution!

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