Skip to content

[COFF][ARM64X] Multi-architecture COFF object files for ARM64X - #202740

Closed
cjacek wants to merge 3 commits into
llvm:mainfrom
cjacek:arm64x-coff
Closed

cjacek wants to merge 3 commits into
llvm:mainfrom
cjacek:arm64x-coff

Conversation

@cjacek

@cjacek cjacek commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

This is a draft of an alternative solution for https://discourse.llvm.org/t/rfc-multi-architecture-coff-object-files-for-arm64x/90723 and https://discourse.llvm.org/t/rfc-introduce-a-wholearchive-marker-embedded-in-archives-themselves/90721. Unlike the previous attempt, this approach does not alter the archive format. Instead, it introduces the .llvm.arm64x section, similar to how .llvm.lto is used for "fat LTO" object files. This allows aware tools to leverage the additional capability while ensuring unaware tools simply ignore the section.

On the Clang side, this is achieved by compiling separately for both the ARM64 and ARM64EC targets and merging the results via an additional llvm-objcopy job. lld-link then selects the correct view of the file depending on the target architecture. Additionally, the archive writer splits the object file into separate members so that they are properly reflected in the symbol map. An advantage of such treatment in archives is that the resulting static library can be used seamlessly by the MSVC linker, as it no longer relies on the .llvm.arm64x section.

@github-actions

github-actions Bot commented Jun 9, 2026 •

Copy link
Copy Markdown

🪟 Windows x64 Test Results

  • 138283 tests passed
  • 4883 tests skipped

✅ The build succeeded and all tests passed.

@cjacek

cjacek commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@github-actions

github-actions Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

✅ With the latest revision this PR passed the C/C++ code formatter.

@github-actions

github-actions Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

🐧 Linux x64 Test Results

  • 142949 tests passed
  • 3026 tests skipped

All executed tests passed, but another part of the build failed. Click on a failure below to see the details.

compiler-rt/lib/tsan/dd/CMakeFiles/clang_rt.dd-x86_64.dir/dd_interceptors.cpp.o
FAILED: compiler-rt/lib/tsan/dd/CMakeFiles/clang_rt.dd-x86_64.dir/dd_interceptors.cpp.o
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/clang++ --target=x86_64-unknown-linux-gnu -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/gha/actions-runner/_work/llvm-project/llvm-project/compiler-rt/lib/tsan/dd/../.. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Xclang -fno-pch-timestamp -Wall -Werror -Wno-unused-parameter -O3 -DNDEBUG -std=c++17 -m64 -fno-lto -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -ftrivial-auto-var-init=pattern -nostdinc++ -fno-rtti -MD -MT compiler-rt/lib/tsan/dd/CMakeFiles/clang_rt.dd-x86_64.dir/dd_interceptors.cpp.o -MF compiler-rt/lib/tsan/dd/CMakeFiles/clang_rt.dd-x86_64.dir/dd_interceptors.cpp.o.d -o compiler-rt/lib/tsan/dd/CMakeFiles/clang_rt.dd-x86_64.dir/dd_interceptors.cpp.o -c /home/gha/actions-runner/_work/llvm-project/llvm-project/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
<inline asm>:11:5: error: 32 bit reloc applied to a field with a different size
11 | jmp __interceptor_pthread_mutex_destroy@plt
|     ^
<inline asm>:21:5: error: 32 bit reloc applied to a field with a different size
21 | jmp __interceptor_pthread_mutex_lock@plt
|     ^
<inline asm>:31:5: error: 32 bit reloc applied to a field with a different size
31 | jmp __interceptor_pthread_mutex_trylock@plt
|     ^
<inline asm>:41:5: error: 32 bit reloc applied to a field with a different size
41 | jmp __interceptor_pthread_mutex_unlock@plt
|     ^
<inline asm>:51:5: error: 32 bit reloc applied to a field with a different size
51 | jmp __interceptor_pthread_spin_destroy@plt
|     ^
<inline asm>:61:5: error: 32 bit reloc applied to a field with a different size
61 | jmp __interceptor_pthread_spin_lock@plt
|     ^
<inline asm>:71:5: error: 32 bit reloc applied to a field with a different size
71 | jmp __interceptor_pthread_spin_trylock@plt
|     ^
<inline asm>:81:5: error: 32 bit reloc applied to a field with a different size
81 | jmp __interceptor_pthread_spin_unlock@plt
|     ^
<inline asm>:91:5: error: 32 bit reloc applied to a field with a different size
91 | jmp __interceptor_pthread_rwlock_destroy@plt
|     ^
<inline asm>:101:5: error: 32 bit reloc applied to a field with a different size
101 | jmp __interceptor_pthread_rwlock_rdlock@plt
|     ^
<inline asm>:111:5: error: 32 bit reloc applied to a field with a different size
111 | jmp __interceptor_pthread_rwlock_tryrdlock@plt
|     ^
<inline asm>:121:5: error: 32 bit reloc applied to a field with a different size
121 | jmp __interceptor_pthread_rwlock_timedrdlock@plt
|     ^
<inline asm>:131:5: error: 32 bit reloc applied to a field with a different size
131 | jmp __interceptor_pthread_rwlock_wrlock@plt
|     ^
<inline asm>:141:5: error: 32 bit reloc applied to a field with a different size
141 | jmp __interceptor_pthread_rwlock_trywrlock@plt
|     ^
<inline asm>:151:5: error: 32 bit reloc applied to a field with a different size
151 | jmp __interceptor_pthread_rwlock_timedwrlock@plt
|     ^
<inline asm>:161:5: error: 32 bit reloc applied to a field with a different size
161 | jmp __interceptor_pthread_rwlock_unlock@plt
|     ^
<inline asm>:171:5: error: 32 bit reloc applied to a field with a different size
171 | jmp __interceptor_pthread_cond_init@plt
|     ^
<inline asm>:181:5: error: 32 bit reloc applied to a field with a different size
181 | jmp __interceptor_pthread_cond_wait@plt
|     ^
<inline asm>:191:5: error: 32 bit reloc applied to a field with a different size
191 | jmp __interceptor_pthread_cond_timedwait@plt
|     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
compiler-rt/lib/tsan/dd/CMakeFiles/RTDD.x86_64.dir/dd_interceptors.cpp.o
FAILED: compiler-rt/lib/tsan/dd/CMakeFiles/RTDD.x86_64.dir/dd_interceptors.cpp.o
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/clang++ --target=x86_64-unknown-linux-gnu -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/gha/actions-runner/_work/llvm-project/llvm-project/compiler-rt/lib/tsan/dd/../.. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Xclang -fno-pch-timestamp -Wall -Werror -Wno-unused-parameter -O3 -DNDEBUG -std=c++17 -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -ftrivial-auto-var-init=pattern -nostdinc++ -fno-rtti -MD -MT compiler-rt/lib/tsan/dd/CMakeFiles/RTDD.x86_64.dir/dd_interceptors.cpp.o -MF compiler-rt/lib/tsan/dd/CMakeFiles/RTDD.x86_64.dir/dd_interceptors.cpp.o.d -o compiler-rt/lib/tsan/dd/CMakeFiles/RTDD.x86_64.dir/dd_interceptors.cpp.o -c /home/gha/actions-runner/_work/llvm-project/llvm-project/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
<inline asm>:11:5: error: 32 bit reloc applied to a field with a different size
11 | jmp __interceptor_pthread_mutex_destroy@plt
|     ^
<inline asm>:21:5: error: 32 bit reloc applied to a field with a different size
21 | jmp __interceptor_pthread_mutex_lock@plt
|     ^
<inline asm>:31:5: error: 32 bit reloc applied to a field with a different size
31 | jmp __interceptor_pthread_mutex_trylock@plt
|     ^
<inline asm>:41:5: error: 32 bit reloc applied to a field with a different size
41 | jmp __interceptor_pthread_mutex_unlock@plt
|     ^
<inline asm>:51:5: error: 32 bit reloc applied to a field with a different size
51 | jmp __interceptor_pthread_spin_destroy@plt
|     ^
<inline asm>:61:5: error: 32 bit reloc applied to a field with a different size
61 | jmp __interceptor_pthread_spin_lock@plt
|     ^
<inline asm>:71:5: error: 32 bit reloc applied to a field with a different size
71 | jmp __interceptor_pthread_spin_trylock@plt
|     ^
<inline asm>:81:5: error: 32 bit reloc applied to a field with a different size
81 | jmp __interceptor_pthread_spin_unlock@plt
|     ^
<inline asm>:91:5: error: 32 bit reloc applied to a field with a different size
91 | jmp __interceptor_pthread_rwlock_destroy@plt
|     ^
<inline asm>:101:5: error: 32 bit reloc applied to a field with a different size
101 | jmp __interceptor_pthread_rwlock_rdlock@plt
|     ^
<inline asm>:111:5: error: 32 bit reloc applied to a field with a different size
111 | jmp __interceptor_pthread_rwlock_tryrdlock@plt
|     ^
<inline asm>:121:5: error: 32 bit reloc applied to a field with a different size
121 | jmp __interceptor_pthread_rwlock_timedrdlock@plt
|     ^
<inline asm>:131:5: error: 32 bit reloc applied to a field with a different size
131 | jmp __interceptor_pthread_rwlock_wrlock@plt
|     ^
<inline asm>:141:5: error: 32 bit reloc applied to a field with a different size
141 | jmp __interceptor_pthread_rwlock_trywrlock@plt
|     ^
<inline asm>:151:5: error: 32 bit reloc applied to a field with a different size
151 | jmp __interceptor_pthread_rwlock_timedwrlock@plt
|     ^
<inline asm>:161:5: error: 32 bit reloc applied to a field with a different size
161 | jmp __interceptor_pthread_rwlock_unlock@plt
|     ^
<inline asm>:171:5: error: 32 bit reloc applied to a field with a different size
171 | jmp __interceptor_pthread_cond_init@plt
|     ^
<inline asm>:181:5: error: 32 bit reloc applied to a field with a different size
181 | jmp __interceptor_pthread_cond_wait@plt
|     ^
<inline asm>:191:5: error: 32 bit reloc applied to a field with a different size
191 | jmp __interceptor_pthread_cond_timedwait@plt
|     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

cjacek added 3 commits July 3, 2026 13:10
Create a separate member for the embedded hybrid object so that it's
properly reflected in the archive's symbol map and can be correctly
processed by tools unaware of multi-arch object files. Prefix the
embedded member name with 'llvm.arm64x/' to avoid name collisions.
…rm64x

When -marm64x is used during the assembly phase, construct jobs for both
native and EC targets and merge their outputs using llvm-objcopy.
@cjacek

cjacek commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Merged in referenced PRs.

@cjacek cjacek closed this Jul 14, 2026
@cjacek
cjacek deleted the arm64x-coff branch July 14, 2026 17:11
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.

1 participant