From 9feec8161fd6b20c921057b2ac3f370f883f4655 Mon Sep 17 00:00:00 2001 From: dan pittman Date: Tue, 14 Nov 2023 17:03:41 -0800 Subject: [PATCH] handle AVX-512 mask register usage in fips delocation process --- util/fipstools/delocate/delocate.go | 7 +++++++ util/fipstools/delocate/delocate.peg | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/util/fipstools/delocate/delocate.go b/util/fipstools/delocate/delocate.go index 9138da1b0b7..94a46146983 100644 --- a/util/fipstools/delocate/delocate.go +++ b/util/fipstools/delocate/delocate.go @@ -1373,6 +1373,13 @@ Args: case ruleRegisterOrConstant, ruleLocalLabelRef: args = append(args, d.contents(fullArg)) + // The AVX-512 mask register is appended to its + // preceding `RegisterOrConstant` without whitespace + // or a comma. + case ruleAVX512Token: + tail := &args[len(args)-1]; + *tail += d.contents(fullArg); + case ruleMemoryRef: symbol, offset, section, didChange, symbolIsLocal, memRef := d.parseMemRef(arg.up) changed = didChange diff --git a/util/fipstools/delocate/delocate.peg b/util/fipstools/delocate/delocate.peg index 1fdabf5094f..0d4116b8c53 100644 --- a/util/fipstools/delocate/delocate.peg +++ b/util/fipstools/delocate/delocate.peg @@ -72,7 +72,7 @@ LocalLabel <- [0-9][0-9$]* LocalLabelRef <- [0-9][0-9$]*[bf] Instruction <- InstructionName (WS InstructionArg ((WS? ','? WS?) InstructionArg)*)? InstructionName <- [[A-Z]][[A-Z.0-9]]* [.+\-]? -InstructionArg <- IndirectionIndicator? (ARMConstantTweak / RegisterOrConstant / LocalLabelRef / TOCRefHigh / TOCRefLow / GOTLocation / GOTSymbolOffset / MemoryRef) AVX512Token* +InstructionArg <- IndirectionIndicator? (ARMConstantTweak / RegisterOrConstant / LocalLabelRef / TOCRefHigh / TOCRefLow / GOTLocation / GOTSymbolOffset / MemoryRef / AVX512Token) GOTLocation <- '$_GLOBAL_OFFSET_TABLE_-' LocalSymbol GOTSymbolOffset <- ('$' SymbolName '@GOT' 'OFF'?) / (":got:" SymbolName) AVX512Token <- WS? '{' '%'? [0-9a-z]* '}'