aix: add required changes to build with clang [v8/v8 : main]

0 views
Skip to first unread message

Toon Verwaest (Gerrit)

unread,
Nov 4, 2025, 10:14:50 AMNov 4
to Abdirahim, Milad Farazmand, Mark Seaborn, Matthias Liedtke, Michael Achenbach, Korinne Adler, Michaël Zasso, AyeAye, Clemens Backes, Mark Mentovai, dmercadi...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Abdirahim, Mark Seaborn, Matthias Liedtke, Michael Achenbach and Milad Farazmand

Toon Verwaest added 4 comments

File src/builtins/ppc/builtins-ppc.cc
Line 4161, Patchset 1 (Latest): __ bind(&no_stack_change);
Toon Verwaest . unresolved

This label could move into the branch above?

File src/compiler/turboshaft/operations.h
Line 529, Patchset 1 (Latest):struct __attribute__((packed)) EffectDimensions {
Toon Verwaest . unresolved

Why is this necessary?

File src/execution/simulator.h
Line 203, Patchset 1 (Latest): void* function_desc[3];
Toon Verwaest . unresolved

Is there no way to achieve this without handwritten assembly?

File src/trap-handler/handler-shared.cc
Line 28, Patchset 1 (Latest):__thread bool TrapHandlerGuard::is_active_ = 0;
Toon Verwaest . unresolved

Why is this needed?

Open in Gerrit

Related details

Attention is currently required from:
  • Abdirahim
  • Mark Seaborn
  • Matthias Liedtke
  • Michael Achenbach
  • Milad Farazmand
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Icc78c58831306aa2f227843b0b4ec2321585fa64
Gerrit-Change-Number: 7107287
Gerrit-PatchSet: 1
Gerrit-Owner: Abdirahim <abdirah...@ibm.com>
Gerrit-Reviewer: Mark Seaborn <msea...@chromium.org>
Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Reviewer: Michael Achenbach <mache...@chromium.org>
Gerrit-Reviewer: Milad Farazmand <mfar...@ibm.com>
Gerrit-Reviewer: Toon Verwaest <verw...@chromium.org>
Gerrit-CC: Clemens Backes <clem...@chromium.org>
Gerrit-CC: Korinne Adler <kad...@us.ibm.com>
Gerrit-CC: Mark Mentovai <ma...@chromium.org>
Gerrit-CC: Michaël Zasso <mic.b...@gmail.com>
Gerrit-Attention: Milad Farazmand <mfar...@ibm.com>
Gerrit-Attention: Michael Achenbach <mache...@chromium.org>
Gerrit-Attention: Mark Seaborn <msea...@chromium.org>
Gerrit-Attention: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Attention: Abdirahim <abdirah...@ibm.com>
Gerrit-Comment-Date: Tue, 04 Nov 2025 15:14:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Korinne Adler (Gerrit)

unread,
Nov 4, 2025, 12:44:24 PMNov 4
to Abdirahim, Milad Farazmand, Toon Verwaest, Mark Seaborn, Matthias Liedtke, Michael Achenbach, Michaël Zasso, AyeAye, Clemens Backes, Mark Mentovai, dmercadi...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Abdirahim, Mark Seaborn, Matthias Liedtke, Michael Achenbach and Milad Farazmand

Korinne Adler added 2 comments

File src/compiler/turboshaft/operations.h
Line 529, Patchset 1 (Latest):struct __attribute__((packed)) EffectDimensions {
Toon Verwaest . unresolved

Why is this necessary?

Korinne Adler

On AIX, Clang (like XLC) promotes bit fields to unsigned int unless packed. This breaks the assertions that the size of these structs are 1 byte large.

File src/execution/simulator.h
Line 203, Patchset 1 (Latest): void* function_desc[3];
Toon Verwaest . unresolved

Is there no way to achieve this without handwritten assembly?

Korinne Adler

We tried multiple ways to do this without, but Clang kept optimizing the descriptor setup away since casting to it is UB. Doing it directly in assembly assures that we get the behavior we need without the optimizer getting in our way.

Gerrit-Comment-Date: Tue, 04 Nov 2025 17:44:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Toon Verwaest <verw...@chromium.org>
unsatisfied_requirement
open
diffy

Toon Verwaest (Gerrit)

unread,
Nov 6, 2025, 5:04:31 AM (13 days ago) Nov 6
to Abdirahim, Milad Farazmand, Mark Seaborn, Matthias Liedtke, Michael Achenbach, Korinne Adler, Michaël Zasso, AyeAye, Clemens Backes, Mark Mentovai, dmercadi...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Abdirahim, Korinne Adler, Mark Seaborn, Matthias Liedtke, Michael Achenbach and Milad Farazmand

Toon Verwaest added 2 comments

File src/compiler/turboshaft/operations.h
Line 529, Patchset 1 (Latest):struct __attribute__((packed)) EffectDimensions {
Toon Verwaest . resolved

Why is this necessary?

Korinne Adler

On AIX, Clang (like XLC) promotes bit fields to unsigned int unless packed. This breaks the assertions that the size of these structs are 1 byte large.

Toon Verwaest

I suppose we could use bitfields or maybe compile v8 with `-fpack-struct` but I guess this is less invasive and more likely to just work.

File src/execution/simulator.h
Line 203, Patchset 1 (Latest): void* function_desc[3];
Toon Verwaest . resolved

Is there no way to achieve this without handwritten assembly?

Korinne Adler

We tried multiple ways to do this without, but Clang kept optimizing the descriptor setup away since casting to it is UB. Doing it directly in assembly assures that we get the behavior we need without the optimizer getting in our way.

Toon Verwaest

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Abdirahim
  • Korinne Adler
Gerrit-Attention: Korinne Adler <kad...@us.ibm.com>
Gerrit-Attention: Milad Farazmand <mfar...@ibm.com>
Gerrit-Attention: Michael Achenbach <mache...@chromium.org>
Gerrit-Attention: Mark Seaborn <msea...@chromium.org>
Gerrit-Attention: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Attention: Abdirahim <abdirah...@ibm.com>
Gerrit-Comment-Date: Thu, 06 Nov 2025 10:04:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Toon Verwaest <verw...@chromium.org>
Comment-In-Reply-To: Korinne Adler <kad...@us.ibm.com>
unsatisfied_requirement
open
diffy

Abdirahim (Gerrit)

unread,
Nov 17, 2025, 7:56:41 PM (2 days ago) Nov 17
to Michael Achenbach, Milad Farazmand, Toon Verwaest, Mark Seaborn, Matthias Liedtke, Korinne Adler, Michaël Zasso, AyeAye, Clemens Backes, Mark Mentovai, dmercadi...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Korinne Adler, Mark Seaborn, Matthias Liedtke, Milad Farazmand and Toon Verwaest

Abdirahim added 1 comment

File src/trap-handler/handler-shared.cc
Line 28, Patchset 1 (Latest):__thread bool TrapHandlerGuard::is_active_ = 0;
Toon Verwaest . unresolved

Why is this needed?

Abdirahim

This is needed because clang complains that is_active is not initialized. on AIX is_active is a __thread.

Open in Gerrit

Related details

Attention is currently required from:
  • Korinne Adler
  • Mark Seaborn
  • Matthias Liedtke
  • Milad Farazmand
  • Toon Verwaest
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Icc78c58831306aa2f227843b0b4ec2321585fa64
Gerrit-Change-Number: 7107287
Gerrit-PatchSet: 1
Gerrit-Owner: Abdirahim <abdirah...@ibm.com>
Gerrit-Reviewer: Mark Seaborn <msea...@chromium.org>
Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Reviewer: Milad Farazmand <mfar...@ibm.com>
Gerrit-Reviewer: Toon Verwaest <verw...@chromium.org>
Gerrit-CC: Clemens Backes <clem...@chromium.org>
Gerrit-CC: Korinne Adler <kad...@us.ibm.com>
Gerrit-CC: Mark Mentovai <ma...@chromium.org>
Gerrit-CC: Michael Achenbach <mache...@chromium.org>
Gerrit-CC: Michaël Zasso <mic.b...@gmail.com>
Gerrit-Attention: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Korinne Adler <kad...@us.ibm.com>
Gerrit-Attention: Milad Farazmand <mfar...@ibm.com>
Gerrit-Attention: Mark Seaborn <msea...@chromium.org>
Gerrit-Attention: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Comment-Date: Tue, 18 Nov 2025 00:56:38 +0000
unsatisfied_requirement
open
diffy

Abdirahim (Gerrit)

unread,
Nov 17, 2025, 7:59:07 PM (2 days ago) Nov 17
to Michael Achenbach, Milad Farazmand, Toon Verwaest, Mark Seaborn, Matthias Liedtke, Korinne Adler, Michaël Zasso, AyeAye, Clemens Backes, Mark Mentovai, dmercadi...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Korinne Adler, Mark Seaborn, Matthias Liedtke, Milad Farazmand and Toon Verwaest

Abdirahim added 1 comment

File src/builtins/ppc/builtins-ppc.cc
Line 4161, Patchset 1 (Latest): __ bind(&no_stack_change);
Toon Verwaest . unresolved

This label could move into the branch above?

Abdirahim

I think we might be able to. @mfar...@ibm.com do you think this would be ok?

Gerrit-Comment-Date: Tue, 18 Nov 2025 00:59:05 +0000
unsatisfied_requirement
open
diffy

Milad Farazmand (Gerrit)

unread,
Nov 18, 2025, 8:27:27 AM (yesterday) Nov 18
to Abdirahim, Michael Achenbach, Toon Verwaest, Mark Seaborn, Matthias Liedtke, Korinne Adler, Michaël Zasso, AyeAye, Clemens Backes, Mark Mentovai, dmercadi...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Abdirahim, Korinne Adler, Mark Seaborn, Matthias Liedtke and Toon Verwaest

Milad Farazmand added 1 comment

File src/builtins/ppc/builtins-ppc.cc
Line 4161, Patchset 1 (Latest): __ bind(&no_stack_change);
Toon Verwaest . unresolved

This label could move into the branch above?

Abdirahim

I think we might be able to. @mfar...@ibm.com do you think this would be ok?

Milad Farazmand

Yes this should be fine.

Open in Gerrit

Related details

Attention is currently required from:
  • Abdirahim
  • Korinne Adler
  • Mark Seaborn
  • Matthias Liedtke
  • Toon Verwaest
Gerrit-Attention: Mark Seaborn <msea...@chromium.org>
Gerrit-Attention: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Attention: Abdirahim <abdirah...@ibm.com>
Gerrit-Comment-Date: Tue, 18 Nov 2025 13:27:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Toon Verwaest <verw...@chromium.org>
Comment-In-Reply-To: Abdirahim <abdirah...@ibm.com>
unsatisfied_requirement
open
diffy

Toon Verwaest (Gerrit)

unread,
Nov 18, 2025, 10:57:13 AM (22 hours ago) Nov 18
to Abdirahim, Michael Achenbach, Milad Farazmand, Mark Seaborn, Matthias Liedtke, Korinne Adler, Michaël Zasso, AyeAye, Clemens Backes, Mark Mentovai, dmercadi...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Abdirahim, Korinne Adler, Mark Seaborn and Matthias Liedtke

Toon Verwaest added 2 comments

File src/execution/simulator.h
Line 206, Patchset 1 (Latest): "li 0, 0\n\t"
Toon Verwaest . unresolved

I don't 100% understand what this code does; but gemini told me that this clobbers r0 which isn't on the clobber list?

File src/trap-handler/handler-shared.cc
Line 28, Patchset 1 (Latest):__thread bool TrapHandlerGuard::is_active_ = 0;
Toon Verwaest . unresolved

Why is this needed?

Abdirahim

This is needed because clang complains that is_active is not initialized. on AIX is_active is a __thread.

Toon Verwaest

Mmh ok weird. Sounds like this might be a linker issue; while `thread_local` should actually be supported by clang?

Open in Gerrit

Related details

Attention is currently required from:
  • Abdirahim
  • Korinne Adler
  • Mark Seaborn
  • Matthias Liedtke
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Icc78c58831306aa2f227843b0b4ec2321585fa64
Gerrit-Change-Number: 7107287
Gerrit-PatchSet: 1
Gerrit-Owner: Abdirahim <abdirah...@ibm.com>
Gerrit-Reviewer: Mark Seaborn <msea...@chromium.org>
Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Reviewer: Milad Farazmand <mfar...@ibm.com>
Gerrit-Reviewer: Toon Verwaest <verw...@chromium.org>
Gerrit-CC: Clemens Backes <clem...@chromium.org>
Gerrit-CC: Korinne Adler <kad...@us.ibm.com>
Gerrit-CC: Mark Mentovai <ma...@chromium.org>
Gerrit-CC: Michael Achenbach <mache...@chromium.org>
Gerrit-CC: Michaël Zasso <mic.b...@gmail.com>
Gerrit-Attention: Korinne Adler <kad...@us.ibm.com>
Gerrit-Attention: Mark Seaborn <msea...@chromium.org>
Gerrit-Attention: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Attention: Abdirahim <abdirah...@ibm.com>
Gerrit-Comment-Date: Tue, 18 Nov 2025 15:57:08 +0000
unsatisfied_requirement
open
diffy

Korinne Adler (Gerrit)

unread,
Nov 18, 2025, 11:47:55 AM (21 hours ago) Nov 18
to Abdirahim, Michael Achenbach, Milad Farazmand, Toon Verwaest, Mark Seaborn, Matthias Liedtke, Michaël Zasso, AyeAye, Clemens Backes, Mark Mentovai, dmercadi...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Abdirahim, Mark Seaborn and Matthias Liedtke

Korinne Adler added 3 comments

File src/execution/simulator.h
Toon Verwaest . unresolved

I don't 100% understand what this code does; but gemini told me that this clobbers r0 which isn't on the clobber list?

Korinne Adler

It does indeed clobber r0, which is why it _is_ in the clobber list (along with memory).

The code is equivalent to the C++ code it replaces, initializing `function_desc` and assigning the address of the descriptor to the `Signature* fn`.

Line by line explanation:
```
std %1, 0(%2) // function_desc[0] = fn_ptr_
li 0, 0 // set r0 = 0 for use in the next two instructions
std 0, 8(%2) // function_desc[1] = 0
std 0, 16(%2) // function_desc[2] = 0
mr %0, %2 // fn = function_desc
```

File src/trap-handler/handler-shared.cc
Line 28, Patchset 1 (Latest):__thread bool TrapHandlerGuard::is_active_ = 0;
Toon Verwaest . unresolved

Why is this needed?

Abdirahim

This is needed because clang complains that is_active is not initialized. on AIX is_active is a __thread.

Toon Verwaest

Mmh ok weird. Sounds like this might be a linker issue; while `thread_local` should actually be supported by clang?

Korinne Adler

In trap-handler-internal.h, `is_active_` is declared as a `__thread` on AIX and links to a GCC bug report to explain why. However, the definition of the variable here still used `thread_local`, which while apparently acceptable on GCC gave a compile error on Clang.

We reached out to the AIX Clang devs to see the recommended way to fix this along with some other TLS-related questions. Hubert Tong (who commented in the GCC bug mentioned previously) told us that using `thread_local` here should be fine, but that it incurs extra overhead over using `__thread`. Since we still need to support GCC for now, it's easier to leave it consistent for AIX between GCC and Clang. Once we drop GCC we should be able to remove the ifdefs.

Line 28, Patchset 1 (Latest):__thread bool TrapHandlerGuard::is_active_ = 0;
Toon Verwaest . unresolved

Why is this needed?

Abdirahim

This is needed because clang complains that is_active is not initialized. on AIX is_active is a __thread.

Toon Verwaest

Mmh ok weird. Sounds like this might be a linker issue; while `thread_local` should actually be supported by clang?

Korinne Adler

In trap-handler-internal.h, is_active_ is defined as a __thread on AIX and links to a GCC bug report to explain why. However, the definition of the variable here still uses thread_local, which while apparently acceptable on GCC gave a compile error on Clang.

We reached out to the AIX Clang devs to see the recommended way to fix this along with some other TLS-related questions. Hubert Tong (who commented in the GCC bug mentioned previously) told us that using thread_local here should be fine, but that it incurs extra overhead over using __thread. Since we still need to support GCC for now, it's easier to leave it consistent for AIX between GCC and Clang. Once we drop GCC we should be able to remove the ifdefs.

Open in Gerrit

Related details

Attention is currently required from:
  • Abdirahim
  • Mark Seaborn
  • Matthias Liedtke
Gerrit-Attention: Mark Seaborn <msea...@chromium.org>
Gerrit-Attention: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Attention: Abdirahim <abdirah...@ibm.com>
Gerrit-Comment-Date: Tue, 18 Nov 2025 16:47:49 +0000
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages