Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/org/openjdk/jextract/JextractTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,11 @@ private int run(String[] args) {

builder.addClangArg("-I" + System.getProperty("user.dir"));

// 64 bit mode on AIX
if (System.getProperty("os.name").toLowerCase().contains("aix")) {
builder.addClangArg("-m64");
}

if (optionSet.nonOptionArguments().isEmpty()) {
printOptionError(logger.format("expected.atleast.one.header"));
return OPTION_ERROR;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/openjdk/jextract/impl/TypeImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
public abstract class TypeImpl implements Type {

public static final boolean IS_WINDOWS = System.getProperty("os.name").startsWith("Windows");
public static final boolean IS_AIX = System.getProperty("os.name").startsWith("AIX");

@Override
public boolean isErroneous() {
Expand Down
9 changes: 8 additions & 1 deletion test/jtreg/generator/testStruct/LibStructTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
* @run testng/othervm --enable-native-access=ALL-UNNAMED LibStructTest
*/
public class LibStructTest {

public static final boolean IS_AIX = System.getProperty("os.name").startsWith("AIX");

@Test
public void testMakePoint() {
try (Arena arena = Arena.ofConfined()) {
Expand Down Expand Up @@ -97,6 +100,10 @@ public void testFieldTypes() {
checkField(g, "ll", C_LONG_LONG);
checkField(g, "ull",C_LONG_LONG);
checkField(g, "f", C_FLOAT);
checkField(g, "d", C_DOUBLE);
if (IS_AIX) {
checkField(g, "d", C_DOUBLE.withByteAlignment(4));
} else {
checkField(g, "d", C_DOUBLE);
}
}
}
1 change: 1 addition & 0 deletions test/lib/testlib/JextractToolRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class JextractToolRunner {
public static final boolean IS_WINDOWS = System.getProperty("os.name").startsWith("Windows");
public static final boolean IS_LINUX = System.getProperty("os.name").equals("Linux");
public static final boolean IS_AARCH64 = System.getProperty("os.arch").equals("aarch64");
public static final boolean IS_AIX = System.getProperty("os.name").equals("AIX");

public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN;
public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void testBaz() {
StructLayout layout = (StructLayout) findLayout(baz);
assertEquals(layout.memberLayouts().get(0), C_CHAR.withName("c"));
// Note here: on some platforms, the bitfield needs to be aligned and requires more padding
int paddingBytes = (IS_WINDOWS || (IS_LINUX && IS_AARCH64)) ? 11 : 8;
int paddingBytes = (IS_WINDOWS || (IS_LINUX && IS_AARCH64) || IS_AIX) ? 11 : 8;
assertEquals(layout.memberLayouts().get(1), MemoryLayout.paddingLayout(paddingBytes));
}

Expand Down