Skip to content

Commit fcf8b99

Browse files
abmusseV8 LUCI CQ
authored andcommitted
aix: add required changes to build with clang
Change-Id: Icc78c58831306aa2f227843b0b4ec2321585fa64 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7107287 Reviewed-by: Toon Verwaest <[email protected]> Commit-Queue: Clemens Backes <[email protected]> Reviewed-by: Leszek Swirski <[email protected]> Cr-Commit-Position: refs/heads/main@{#104364}
1 parent 86be023 commit fcf8b99

5 files changed

Lines changed: 32 additions & 11 deletions

File tree

BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ config("toolchain") {
16011601
if (v8_current_cpu == "ppc64") {
16021602
defines += [ "V8_TARGET_ARCH_PPC64" ]
16031603
cflags += [ "-ffp-contract=off" ]
1604-
if (current_os == "aix") {
1604+
if (current_os == "aix" && !is_clang) {
16051605
cflags += [
16061606
# Work around AIX ceil, trunc and round oddities.
16071607
"-mcpu=power5+",

src/builtins/ppc/builtins-ppc.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4135,6 +4135,19 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
41354135

41364136
// If return value is on the stack, pop it to registers.
41374137
if (needs_return_buffer) {
4138+
Label done;
4139+
if (switch_to_central_stack) {
4140+
Label no_stack_change;
4141+
__ CmpU64(kOldSPRegister, Operand(0), r0);
4142+
__ beq(&no_stack_change);
4143+
__ addi(r3, kOldSPRegister,
4144+
Operand((kStackFrameExtraParamSlot + 1) * kSystemPointerSize));
4145+
__ b(&done);
4146+
__ bind(&no_stack_change);
4147+
}
4148+
__ addi(r3, sp,
4149+
Operand((kStackFrameExtraParamSlot + 1) * kSystemPointerSize));
4150+
__ bind(&done);
41384151
__ LoadU64(r4, MemOperand(r3, kSystemPointerSize));
41394152
__ LoadU64(r3, MemOperand(r3));
41404153
}

src/compiler/turboshaft/operations.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ class InputsRepFactory {
528528
};
529529
};
530530

531-
struct EffectDimensions {
531+
struct __attribute__((packed)) EffectDimensions {
532532
// Produced by loads, consumed by operations that should not move before loads
533533
// because they change memory.
534534
bool load_heap_memory : 1;
@@ -623,7 +623,7 @@ static_assert(sizeof(EffectDimensions) == sizeof(EffectDimensions::Bits));
623623
// they become more restricted in their movement. Note that calls are not the
624624
// most side-effectful operations, as they do not leave the heap in an
625625
// inconsistent state, so they do not need to be marked as raw heap access.
626-
struct OpEffects {
626+
struct __attribute__((packed)) OpEffects {
627627
EffectDimensions produces;
628628
EffectDimensions consumes;
629629

@@ -2902,7 +2902,7 @@ struct ConstantOp : FixedArityOperationT<0, ConstantOp> {
29022902
// When result_rep is RegisterRepresentation::Compressed(), then the load does
29032903
// not decompress the value.
29042904
struct LoadOp : OperationT<LoadOp> {
2905-
struct Kind {
2905+
struct __attribute__((packed)) Kind {
29062906
// The `base` input is a tagged pointer to a HeapObject.
29072907
bool tagged_base : 1;
29082908
// The effective address might be unaligned. This is only set to true if

src/execution/simulator.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,17 @@ class GeneratedCode {
199199
return fn(args...);
200200
#else
201201
// AIX ABI requires function descriptors (FD). Artificially create a pseudo
202-
// FD to ensure correct dispatch to generated code. The 'volatile'
203-
// declaration is required to avoid the compiler from not observing the
204-
// alias of the pseudo FD to the function pointer, and hence, optimizing the
205-
// pseudo FD declaration/initialization away.
206-
volatile Address function_desc[] = {reinterpret_cast<Address>(fn_ptr_), 0,
207-
0};
208-
Signature* fn = reinterpret_cast<Signature*>(function_desc);
202+
// FD to ensure correct dispatch to generated code.
203+
void* function_desc[3];
204+
Signature* fn;
205+
asm("std %1, 0(%2)\n\t"
206+
"li 0, 0\n\t"
207+
"std 0, 8(%2)\n\t"
208+
"std 0, 16(%2)\n\t"
209+
"mr %0, %2\n\t"
210+
: "=r"(fn)
211+
: "r"(fn_ptr_), "r"(function_desc)
212+
: "memory", "0");
209213
return fn(args...);
210214
#endif // V8_OS_ZOS
211215
#else

src/trap-handler/handler-shared.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ namespace v8 {
2424
namespace internal {
2525
namespace trap_handler {
2626

27+
#if defined(V8_OS_AIX)
28+
__thread bool TrapHandlerGuard::is_active_ = 0;
29+
#else
2730
thread_local bool TrapHandlerGuard::is_active_ = 0;
31+
#endif
2832

2933
size_t gNumCodeObjects = 0;
3034
CodeProtectionInfoListEntry* gCodeObjects = nullptr;

0 commit comments

Comments
 (0)