Hi Kamila,

thanks for the review. Revised patch attached, now in git format-patch form. 
Addressing your points:

- The LIBC hunk is gone; agreed it was dead code.
- The UNAME_MACHINE normalization is gone too. The block is now just 
GUESS=$UNAME_MACHINE-unknown-linux-ohos.
- Added an entry to testsuite/config-guess.data.

On `-linux-`: this follows how LLVM upstream models the platform. In llvm's 
TargetParser/Triple.h [1], `ohos` parses as the environment component on top of 
the Linux OS (`aarch64-linux-ohos` -> OS=Linux, Environment=OpenHOS), and 
`Triple::OpenHOS` sits in the musl environment family (`isMusl()`). The 
toolchain released by the OpenHarmony official community reports the same 
target:

$ clang -v
clang version 15.0.4 ...
Target: aarch64-unknown-linux-ohos

The device is musl based (/lib/ld-musl-aarch64.so.1), and config.sub already 
takes `linux-ohos*` since the 2024 OpenHarmony patch, so keeping `-linux-` in 
config.guess just produces the triplets the on-device toolchains emit, which is 
what autotools builds on these machines end up consuming. The patch itself only 
touches the config.guess output for `uname -s = HarmonyOS`; config.sub and its 
validation are unchanged.

Verification: a full autotools build of GNU hello 2.12.1 completes on-device 
with this exact config.guess and the upstream config.sub -- configure reports 
`build system type: aarch64-unknown-linux-ohos`, and `make` and the resulting 
binary run fine. The same detection has also been through complete `configure 
&& make` cycles for other packages on this platform (PHP 8.5.8, git 2.56.0) 
including their upstream test suites.

$ uname -s
HarmonyOS
$ uname -m
aarch64
$ uname -r
HongMeng Kernel 1.13.0
$ sh config.guess
aarch64-unknown-linux-ohos

[1] 
https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/TargetParser/Triple.h

Best regards,
goblinrs
From 4698187f025561cd6123e77e5cda868ec420761b Mon Sep 17 00:00:00 2001
From: goblinrs <[email protected]>
Date: Tue, 20 Oct 2026 20:54:54 +0800
Subject: [PATCH] config.guess: recognize HarmonyOS

HarmonyOS PC devices report 'HarmonyOS' from uname -s and fall through
to 'unknown' today.  Map to $UNAME_MACHINE-unknown-linux-ohos, matching
the 'linux-ohos' kernel-O/S combination that config.sub already accepts
(since the 2024 OpenHarmony patch) and that LLVM upstream models for
this platform (aarch64-linux-ohos, musl based, see Triple.h).  Verified
on HarmonyOS PC (aarch64, HongMeng Kernel 1.13.0):

sh config.guess => aarch64-unknown-linux-ohos
---
 config.guess                | 3 +++
 testsuite/config-guess.data | 1 +
 2 files changed, 4 insertions(+)

diff --git a/config.guess b/config.guess
index c7f4c32..2503cb9 100755
--- a/config.guess
+++ b/config.guess
@@ -1432,6 +1432,9 @@ EOF
     *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
 	GUESS=$UNAME_MACHINE-unknown-haiku
 	;;
+    *:HarmonyOS:*:*)	# HarmonyOS (HongMeng Kernel), musl-based OHOS variant
+	GUESS=$UNAME_MACHINE-unknown-linux-ohos
+	;;
     SX-4:SUPER-UX:*:*)
 	GUESS=sx4-nec-superux$UNAME_RELEASE
 	;;
diff --git a/testsuite/config-guess.data b/testsuite/config-guess.data
index 61655db..17ab6cb 100644
--- a/testsuite/config-guess.data
+++ b/testsuite/config-guess.data
@@ -25,6 +25,7 @@ SX-8 | 1.0 | SUPER-UX | ignored | ignored | sx8-nec-superux1.0
 SX-8R | 1.0 | SUPER-UX | ignored | ignored | sx8r-nec-superux1.0
 SX-ACE | 1.0 | SUPER-UX | ignored | ignored | sxace-nec-superux1.0
 aarch64 | ignored | Haiku | ignored | ignored | aarch64-unknown-haiku
+aarch64 | ignored | HarmonyOS | ignored | ignored | aarch64-unknown-linux-ohos
 aarch64 | ignored | Linux | ignored | ignored | aarch64-unknown-linux-gnu
 aarch64 | ignored | Managarm | ignored | ignored | aarch64-unknown-managarm-mlibc
 aarch64_be | ignored | Linux | ignored | ignored | aarch64_be-unknown-linux-gnu
-- 
2.45.2

Reply via email to