Skip to content

Commit 67636d7

Browse files
authored
[llvm][AIX] Fix triple OS version on PASE (#163392)
The OS version is added to the triple with the value returned by uname. However, PASE uses different versioning from AIX, so the uname value needs to be mapped to AIX first.
1 parent 3f3af56 commit 67636d7

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

llvm/lib/TargetParser/Unix/Host.inc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,30 @@ static std::string updateTripleOSVersion(std::string TargetTripleString) {
5959
if (TT.getOS() == Triple::AIX && !TT.getOSMajorVersion()) {
6060
struct utsname name;
6161
if (uname(&name) != -1) {
62+
std::string release = name.release;
63+
64+
if (strcmp(name.sysname, "OS400") == 0) {
65+
/*
66+
PASE uses different versioning system than AIX.
67+
The following table shows the currently supported PASE
68+
releases and the corresponding AIX release:
69+
--------------------------
70+
PASE | AIX
71+
--------------------------
72+
V7R4 | 7.2 (TL2)
73+
--------------------------
74+
V7R5 | 7.2 (TL5)
75+
--------------------------
76+
V7R6 | 7.3 (TL1)
77+
--------------------------
78+
*/
79+
release = (release == "4" || release == "5") ? "2" : "3";
80+
}
81+
6282
std::string NewOSName = std::string(Triple::getOSTypeName(Triple::AIX));
6383
NewOSName += name.version;
6484
NewOSName += '.';
65-
NewOSName += name.release;
85+
NewOSName += release;
6686
NewOSName += ".0.0";
6787
TT.setOSName(NewOSName);
6888
return TT.str();

0 commit comments

Comments
 (0)