target:
- i686-pc-windows-msvc/msvc
- x86_64-pc-windows-msvc/msvc
+ - aarch64-pc-windows-msvc/msvc
- x86_64-apple-darwin/clang
- aarch64-apple-darwin/clang
- x86_64-unknown-linux-gnu/gcc
architecture: x64
runner: windows-latest
compiler: msvc
+ - target: aarch64-pc-windows-msvc/msvc
+ architecture: ARM64
+ runner: windows-latest
+ compiler: msvc
- target: x86_64-apple-darwin/clang
architecture: x86_64
runner: macos-13
with:
python-version: '3.11'
- - name: Windows
- if: runner.os == 'Windows'
+ - name: Native Windows
+ if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
run: |
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
./PCbuild/rt.bat ${{ matrix.debug && '-d' }} -p ${{ matrix.architecture }} -q --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
- - name: macOS
+ # No PGO or tests (yet):
+ - name: Emulated Windows
+ if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
+ run: |
+ choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
+ ./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
+
+ - name: Native macOS
if: runner.os == 'macOS'
run: |
brew install llvm@${{ matrix.llvm }}
// - https://github.com/llvm/llvm-project/blob/main/lld/MachO/Arch/ARM64.cpp
// - https://github.com/llvm/llvm-project/blob/main/lld/MachO/Arch/ARM64Common.cpp
// - https://github.com/llvm/llvm-project/blob/main/lld/MachO/Arch/ARM64Common.h
+ // - aarch64-pc-windows-msvc:
+ // - https://github.com/llvm/llvm-project/blob/main/lld/COFF/Chunks.cpp
// - aarch64-unknown-linux-gnu:
// - https://github.com/llvm/llvm-project/blob/main/lld/ELF/Arch/AArch64.cpp
// - i686-pc-windows-msvc:
assert((int64_t)value < (1LL << 31));
*loc32 = (uint32_t)value;
continue;
+ case HoleKind_IMAGE_REL_ARM64_BRANCH26:
case HoleKind_R_AARCH64_CALL26:
case HoleKind_R_AARCH64_JUMP26:
// 28-bit relative branch.
set_bits(loc32, 5, value, 48, 16);
continue;
case HoleKind_ARM64_RELOC_GOT_LOAD_PAGE21:
+ case HoleKind_IMAGE_REL_ARM64_PAGEBASE_REL21:
case HoleKind_R_AARCH64_ADR_GOT_PAGE:
// 21-bit count of pages between this page and an absolute address's
// page... I know, I know, it's weird. Pairs nicely with
const Hole *next_hole = &stencil->holes[i + 1];
if (i + 1 < stencil->holes_size &&
(next_hole->kind == HoleKind_ARM64_RELOC_GOT_LOAD_PAGEOFF12 ||
+ next_hole->kind == HoleKind_IMAGE_REL_ARM64_PAGEOFFSET_12L ||
next_hole->kind == HoleKind_R_AARCH64_LD64_GOT_LO12_NC) &&
next_hole->offset == hole->offset + 4 &&
next_hole->symbol == hole->symbol &&
continue;
case HoleKind_ARM64_RELOC_GOT_LOAD_PAGEOFF12:
case HoleKind_ARM64_RELOC_PAGEOFF12:
+ case HoleKind_IMAGE_REL_ARM64_PAGEOFFSET_12A:
+ case HoleKind_IMAGE_REL_ARM64_PAGEOFFSET_12L:
case HoleKind_R_AARCH64_LD64_GOT_LO12_NC:
// 12-bit low part of an absolute address. Pairs nicely with
// ARM64_RELOC_GOT_LOAD_PAGE21 (above).
"ARM64_RELOC_PAGEOFF12",
"ARM64_RELOC_UNSIGNED",
"IMAGE_REL_AMD64_REL32",
+ "IMAGE_REL_ARM64_BRANCH26",
+ "IMAGE_REL_ARM64_PAGEBASE_REL21",
+ "IMAGE_REL_ARM64_PAGEOFFSET_12A",
+ "IMAGE_REL_ARM64_PAGEOFFSET_12L",
"IMAGE_REL_I386_DIR32",
"IMAGE_REL_I386_REL32",
"R_AARCH64_ABS64",
addend = (
int.from_bytes(raw[offset : offset + 4], "little", signed=True) - 4
)
+ case {
+ "Offset": offset,
+ "Symbol": s,
+ "Type": {
+ "Value": "IMAGE_REL_ARM64_BRANCH26"
+ | "IMAGE_REL_ARM64_PAGEBASE_REL21"
+ | "IMAGE_REL_ARM64_PAGEOFFSET_12A"
+ | "IMAGE_REL_ARM64_PAGEOFFSET_12L" as kind
+ },
+ }:
+ offset += base
+ value, symbol = self._unwrap_dllimport(s)
+ addend = 0
case _:
raise NotImplementedError(relocation)
return _stencils.Hole(offset, kind, value, symbol, addend)
if re.fullmatch(r"aarch64-apple-darwin.*", host):
args = ["-mcmodel=large"]
return _MachO(host, alignment=8, args=args, prefix="_")
+ if re.fullmatch(r"aarch64-pc-windows-msvc", host):
+ args = ["-fms-runtime-lib=dll"]
+ return _COFF(host, alignment=8, args=args)
if re.fullmatch(r"aarch64-.*-linux-gnu", host):
args = ["-mcmodel=large"]
return _ELF(host, alignment=8, args=args)