Skip to content
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

fatal error LNK1322: cannot avoid potential ARM hazard (Cortex-A53 MPCore processor bug #843419) in section 0x1 #79740

Open
weliveindetail opened this issue Mar 3, 2025 · 4 comments
Labels
arm64 Architecture: arm64 (aarch64) — any 64-bit ARM bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. continuous integration unexpected error Bug: Unexpected error Windows Platform: Windows

Comments

@weliveindetail
Copy link
Member

We see the following failure since https://ci-external.swift.org/job/swift-main-windows-toolchain-arm64/1023/ (Mar 1):

[23/52][ 44%][95.515s]Linking Swift shared library Sources\SWBCore\SWBCore.dll
FAILED: Sources/SWBCore/SWBCore.dll Sources/SWBCore/SWBCore.lib 
C:\Windows\system32\cmd.exe /C "cd . && T:\1\bin\swiftc.exe -target aarch64-unknown-windows-msvc -j 36 -num-threads 36 -emit-library -sdk "T:/Program Files/Swift/Platforms/Windows.platform/Developer/SDKs/Windows.sdk" -gnone -Xlinker /INCREMENTAL:NO -Xlinker /OPT:REF -Xlinker /OPT:ICF -O -swift-version 5 -libc MD   -Xlinker -implib:Sources\SWBCore\SWBCore.lib   -o Sources\SWBCore\SWBCore.dll @CMakeFiles\SWBCore.rsp && cd ."
<unknown>:0: warning: using (deprecated) legacy driver, Swift installation does not contain swift-driver at: 'C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain-arm64\build\1\bin\swift-driver-new.exe'
   Creating library Sources\SWBCore\SWBCore.lib and object Sources\SWBCore\SWBCore.exp
BuiltinMacros.swift.obj : fatal error LNK1322: cannot avoid potential ARM hazard (Cortex-A53 MPCore processor bug #843419) in section 0x1; please consider using compiler option /Gy if it was not used
clang: error: linker command failed with exit code 1322 (use -v to see invocation)

It may have existed before and hidden by another build issue (Feb 28). Last successful build was Feb 27.

@weliveindetail
Copy link
Member Author

I am not familiar with the details of this breakage, but I assume it's fine to add the recommend compiler option /Gy which enables Function-Level Linking. swift-build is not huge codebase, so link-times shouldn't be critical. And Cortex-A53 doesn't seem like a relevant target for the toolchain.

@compnerd
Copy link
Member

compnerd commented Mar 3, 2025

Oh, this is interesting! This seems like a LLVM bug. /Gy is not applicable here as that is from the Swift compiler and /Gy is a C/C++ (clang-cl) option.

@compnerd
Copy link
Member

compnerd commented Mar 3, 2025

FTR, Errata 843419 deals with a adrp in the last 8-bytes of a 4k (page) boundary may not resolve properly. There is a BFD level workaround where the instruction is attempted to be relaxed to a adr if possible or otherwise a veneer is inserted.

@compnerd compnerd changed the title arm64 Windows Mainline bot fails with a linker error fatal error LNK1322: cannot avoid potential ARM hazard (Cortex-A53 MPCore processor bug #843419) in section 0x1 Mar 3, 2025
@compnerd compnerd added Windows Platform: Windows arm64 Architecture: arm64 (aarch64) — any 64-bit ARM labels Mar 3, 2025
hjyamauchi added a commit to hjyamauchi/swift that referenced this issue Mar 4, 2025
hjyamauchi added a commit to hjyamauchi/swift that referenced this issue Mar 4, 2025
hjyamauchi added a commit to hjyamauchi/swift that referenced this issue Mar 5, 2025
hjyamauchi added a commit to hjyamauchi/swift that referenced this issue Mar 5, 2025
@hjyamauchi
Copy link
Contributor

A workaround merged: #79768

@AnthonyLatsis AnthonyLatsis added continuous integration bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. unexpected error Bug: Unexpected error labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arm64 Architecture: arm64 (aarch64) — any 64-bit ARM bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. continuous integration unexpected error Bug: Unexpected error Windows Platform: Windows
Projects
None yet
Development

No branches or pull requests

4 participants