Skip to content

Add msl to ARMConstantTweak and recognise ldrsw to prevent delocator errors #2177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions util/fipstools/delocate/delocate.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,8 @@ func (d *delocation) processAarch64Instruction(statement, instruction *node32) (

if parts != nil {
if parts.pegRule == ruleARMGOTLow12 {
if instructionName != "ldr" {
panic("Symbol reference outside of ldr instruction")
if instructionName != "ldr" && instructionName != "ldrsw" {
panic("Symbol reference outside of ldr/ldrsw instruction")
}

if skipWS(parts.next) != nil || parts.up.next != nil {
Expand All @@ -656,8 +656,8 @@ func (d *delocation) processAarch64Instruction(statement, instruction *node32) (
}
return statement, nil
} else if parts.pegRule == ruleLow12BitsSymbolRef {
if instructionName != "ldr" {
panic("Symbol reference outside of ldr instruction")
if instructionName != "ldr" && instructionName != "ldrsw" {
panic("Symbol reference outside of ldr/ldrsw instruction")
}

// The check for "parts.up.next != nil" was removed because gcc/release appends an
Expand Down
2 changes: 1 addition & 1 deletion util/fipstools/delocate/delocate.peg
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ RegisterOrConstant <- (('%'[[A-Z]][[A-Z0-9]]*) /
('#(' [0-9]+ ')') /
ARMRegister)
![fb:(+\-]
ARMConstantTweak <- ((([us] "xt" [xwhb]) / "lsl" / "lsr" / "ror" / "asr") (WS '#'? Offset)?)/
ARMConstantTweak <- ((([us] "xt" [xwhb]) / "lsl" / "lsr" / "ror" / "asr" / "msl") (WS '#'? Offset)?)/
"mul vl" # multiply offset by the hardware's vector length
ARMRegister <- "sp" / ([xwdqshb] [0-9] [0-9]? !(ARMRegisterBoundary)) / "xzr" / "wzr" / "NZCV" / ARMVectorRegister / SVE2PredicateRegister /
('{' WS? ARMVectorRegister WS? ([,\-] WS? ARMVectorRegister)* WS? '}' ('[' [0-9] [0-9]? ']')? )
Expand Down
Loading
Loading