AIX: .csect support for XCOFFAsmParser
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Hello I'm compiling V8 on AIX and ran into an issue in the backend not supporting `.csect` directive. I'm making this issue to request adding support for it.
```text
Fatal error: error in backend: XCOFFAsmParser directive not yet supported!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/llvm/clang+llvm-20.1.7-powerpc64-ibm-aix-7.2/bin/clang++ -MD -MF obj/v8_heap_base/push_registers_asm.o.d -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__LIBC_NO_CPP_MATH_OVERLOADS__ -D_GNU_SOURCE -D_ALL_SOURCE=1 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_INSTRUMENTED_WITH_ASAN=0 -DCR_LIBCXX_REVISION=2c359c239b138a20a03f798e47889448ef131c22 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DV8_INTL_SUPPORT -DV8_USE_EXTERNAL_STARTUP_DATA -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_WIN64_UNWINDING_INFO -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_ENABLE_FUZZTEST -DV8_ENABLE_SPARKPLUG -DV8_ENABLE_TURBOFAN -DV8_ENABLE_WEBASSEMBLY -DV8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -DV8_USE_ZLIB -DV8_USE_LIBM_TRIG_FUNCTIONS -DV8_ENABLE_MAGLEV_GRAPH_PRINTER -DV8_ENABLE_EXTENSIBLE_RO_SNAPSHOT -DV8_ENABLE_BLACK_ALLOCATED_PAGES -DV8_ENABLE_LEAPTIERING -DV8_WASM_RANDOM_FUZZERS -DV8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT=0 -DV8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT=0 -DV8_PROMISE_INTERNAL_FIELD_COUNT=0 -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -DCPPGC_ENABLE_LARGER_CAGE -DCPPGC_SLIM_WRITE_BARRIER -DV8_TARGET_ARCH_PPC64 -DV8_RUNTIME_CALL_STATS -DABSL_ALLOCATOR_NOTHROW=1 -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../include -Igen/include -I../../third_party/abseil-cpp -Wall -Wextra -Wimplicit-fallthrough -Wextra-semi -Wunreachable-code-aggressive -Wthread-safety -Wgnu -Wno-gnu-anonymous-struct -Wno-gnu-conditional-omitted-operand -Wno-gnu-include-next -Wno-gnu-label-as-value -Wno-gnu-redeclared-enum -Wno-gnu-statement-expression -Wno-gnu-zero-variadic-macro-arguments -Wno-zero-length-array -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wno-cast-function-type -Wno-thread-safety-reference-return -Wshadow -fno-delete-null-pointer-checks -fno-strict-overflow -fno-ident -fno-strict-aliasing -funwind-tables -fcolor-diagnostics -fmerge-all-constants -fno-sized-deallocation -fcrash-diagnostics-dir=../../tools/clang/crashreports -ffp-contract=off -fcomplete-member-pointers -Wall -Wno-unused-parameter -pthread -Wmissing-field-initializers -Wno-uninitialized -mfprnd -maix64 -fdata-sections -ffunction-sections -O3 --target=powerpc64-ibm-aix -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -no-canonical-prefixes -fomit-frame-pointer -g0 -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -ffp-contract=off -mfprnd -Wunreachable-code -Wno-shadow -Wctad-maybe-unsupported -Wno-invalid-offsetof -Wmissing-field-initializers -O3 -fno-math-errno -Wexit-time-destructors -Wno-invalid-offsetof -Wenum-compare-conditional -Wno-nullability-completeness -std=c++20 -Wno-trigraphs -gsimple-template-names -fno-rtti -fno-exceptions -Wno-narrowing -Wno-non-virtual-dtor -fno-exceptions -fno-rtti -nostdinc++ -isystem../../third_party/libc++/src/include -isystem../../third_party/libc++abi/src/include -c ../../src/heap/base/asm/ppc/push_registers_asm.cc -o obj/v8_heap_base/push_registers_asm.o
1. parser at end of file
2. Code generation
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 20.1.7 (https://github.com/llvm/llvm-project.git 6146a88f60492b520a36f8f8f3231e15f3cc6082)
Target: powerpc64-ibm-aix
Thread model: posix
InstalledDir: /home/llvm/clang+llvm-20.1.7-powerpc64-ibm-aix-7.2/bin
clang++: note: diagnostic msg:
********************
```
The code that is getting compiled was the following:
`-c ../../src/heap/base/asm/ppc/push_registers_asm.cc -o obj/v8_heap_base/push_registers_asm.o`
```c
#if defined(_AIX)
".globl .PushAllRegistersAndIterateStack, hidden \n"
".csect .text[PR] \n"
".PushAllRegistersAndIterateStack: \n"
...
```
https://chromium.googlesource.com/v8/v8/+/11781fed53b2aa18a087ec7f5984ef5445146e63/src/heap/base/asm/ppc/push_registers_asm.cc#22
I was able to workaround this by passing `-fno-integrated-as` but I would like to not have to pass this flag everywhere and just use the integrated as.
Contributor guide
Research direction
Start with the XCOFFAsmParser entry point and reproduce the failure using the reported clang++ command on AIX. Inspect how assembler directives are dispatched, using V8's src/heap/base/asm/ppc/push_registers_asm.cc and its .csect usage as the case to support. Done means the integrated assembler accepts this input without -fno-integrated-as and has regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100