这是indexloc提供的服务,不要输入任何密码
Skip to content

bump(flang/libllvm): 20.1.7 to 20.1.8 #25346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 27, 2025
Merged

bump(flang/libllvm): 20.1.7 to 20.1.8 #25346

merged 2 commits into from
Jul 27, 2025

Conversation

finagolfin
Copy link
Member

Plus try out @MohammedKHC0's patch from #25178.

@finagolfin
Copy link
Member Author

Try out these builds with the sysroot change, as I will be, and let us know how they work for you.

Copy link
Contributor

@robertkirkman robertkirkman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell after a second series of basic tests, this is working completely perfectly and the relative sysroot setting doesn't cause any currently known errors in anything.

I've also been able to actually observe at runtime, through the different output of the command cp $(command -v clang-20) . && ./clang-20 -### test.c, that the sysroot does indeed appear to be mobile, theoretically making the Termux on-device toolchain built portably for copying to different folders, exactly like the official NDK is!

Current master branch

clang version 20.1.7
Target: aarch64-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/home
 "/data/data/com.termux/files/home/clang-20" "-cc1" "-triple" "aarch64-unknown-linux-android24" "-emit-obj" "-dumpdir" "a-" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test.c" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=non-leaf" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "generic" "-target-feature" "+v8a" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+fix-cortex-a53-835769" "-target-abi" "aapcs" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/data/data/com.termux/files/home" "-fcoverage-compilation-dir=/data/data/com.termux/files/home" "-resource-dir" "/data/data/com.termux/files/lib/clang/20" "-isysroot" "/data/data/com.termux/files" "-internal-isystem" "/data/data/com.termux/files/lib/clang/20/include" "-internal-isystem" "/data/data/com.termux/files/usr/local/include" "-internal-externc-isystem" "/data/data/com.termux/files/usr/include/aarch64-linux-android" "-internal-externc-isystem" "/data/data/com.termux/files/include" "-internal-externc-isystem" "/data/data/com.termux/files/usr/include" "-ferror-limit" "19" "-femulated-tls" "-fno-signed-char" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-fcolor-diagnostics" "-target-feature" "+outline-atomics" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "/data/data/com.termux/files/usr/tmp/test-5102df.o" "-x" "c" "test.c"
 "/data/data/com.termux/files/usr/bin/ld.lld" "--sysroot=/data/data/com.termux/files" "-EL" "--fix-cortex-a53-843419" "-z" "now" "-z" "relro" "-z" "max-page-size=16384" "--no-rosegment" "--hash-style=gnu" "-rpath=/data/data/com.termux/files/usr/lib" "--eh-frame-hdr" "-m" "aarch64linux" "-pie" "-dynamic-linker" "/system/bin/linker64" "-o" "a.out" "/data/data/com.termux/files/usr/lib/crtbegin_dynamic.o" "-L/data/data/com.termux/files/usr/lib/aarch64-linux-android" "-L/data/data/com.termux/files/usr/lib" "-L/data/data/com.termux/files/usr/aarch64-linux-android/lib" "-L/system/lib64" "/data/data/com.termux/files/usr/tmp/test-5102df.o" "/data/data/com.termux/files/lib/clang/20/lib/aarch64-unknown-linux-android24/libclang_rt.builtins.a" "-l:libunwind.a" "-ldl" "-lc" "/data/data/com.termux/files/lib/clang/20/lib/aarch64-unknown-linux-android24/libclang_rt.builtins.a" "-l:libunwind.a" "-ldl" "/data/data/com.termux/files/usr/lib/crtend_android.o"

After this PR or the other PR with the relative sysroot setting enabled

clang version 20.1.8
Target: aarch64-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/home
 "/data/data/com.termux/files/home/clang-20" "-cc1" "-triple" "aarch64-unknown-linux-android24" "-emit-obj" "-dumpdir" "a-" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test.c" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=non-leaf" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "generic" "-target-feature" "+v8a" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+fix-cortex-a53-835769" "-target-abi" "aapcs" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/data/data/com.termux/files/home" "-fcoverage-compilation-dir=/data/data/com.termux/files/home" "-resource-dir" "/data/data/com.termux/files/lib/clang/20" "-isysroot" "/data/data/com.termux/files/home/../.." "-internal-isystem" "/data/data/com.termux/files/lib/clang/20/include" "-internal-isystem" "/data/data/com.termux/files/home/../../usr/local/include" "-internal-externc-isystem" "/data/data/com.termux/files/home/../../include" "-internal-externc-isystem" "/data/data/com.termux/files/home/../../usr/include" "-ferror-limit" "19" "-femulated-tls" "-fno-signed-char" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-fcolor-diagnostics" "-target-feature" "+outline-atomics" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "/data/data/com.termux/files/usr/tmp/test-135c87.o" "-x" "c" "test.c"
 "/data/data/com.termux/files/usr/bin/ld.lld" "--sysroot=/data/data/com.termux/files/home/../.." "-EL" "--fix-cortex-a53-843419" "-z" "now" "-z" "relro" "-z" "max-page-size=16384" "--no-rosegment" "--hash-style=gnu" "-rpath=/data/data/com.termux/files/home/../../usr/lib" "--eh-frame-hdr" "-m" "aarch64linux" "-pie" "-dynamic-linker" "/system/bin/linker64" "-o" "a.out" "crtbegin_dynamic.o" "-L/system/lib64" "/data/data/com.termux/files/usr/tmp/test-135c87.o" "/data/data/com.termux/files/lib/clang/20/lib/aarch64-unknown-linux-android24/libclang_rt.builtins.a" "-l:libunwind.a" "-ldl" "-lc" "/data/data/com.termux/files/lib/clang/20/lib/aarch64-unknown-linux-android24/libclang_rt.builtins.a" "-l:libunwind.a" "-ldl" "crtend_android.o"

@robertkirkman
Copy link
Contributor

robertkirkman commented Jul 19, 2025

What's interesting is that I notice that for some reason, the relative path sysroot is not affecting every default include and library path the same way.

For example, when I try a way to test this feature using these commands:

~ $ ./clang-20 test.c
test.c:1:10: fatal error: 'stdio.h' file not found
    1 | #include <stdio.h>
      |          ^~~~~~~~~
1 error generated.
~ $ mkdir test
~ $ mv clang-20 test.c test
~ $ cd test
~/test $ ./clang-20 test.c
In file included from test.c:1:
In file included from /data/data/com.termux/files/home/test/../../usr/include/stdio.h:42:
/data/data/com.termux/files/home/test/../../usr/include/sys/types.h:32:10: fatal error: 'stddef.h' file not found
   32 | #include <stddef.h>
      |          ^~~~~~~~~~
1 error generated.
~/test $ ./clang-20 test.c -I$PREFIX/lib/clang/20/include
ld.lld: error: cannot open /data/data/com.termux/files/home/lib/clang/20/lib/aarch64-unknown-linux-android24/libclang_rt.builtins.a: No such file or directory

Despite the relative sysroot being specified by -DDEFAULT_SYSROOT, the $PREFIX/lib/clang/20/include and $PREFIX/lib/clang/20/lib/aarch64-unknown-linux-android24/libclang_rt.builtins.a paths are included as a different kind of relative path, ../lib not ../../usr/lib, so it requires this to compile successfully if the clang binary is ever moved to a folder like files/home/test that's nested two folders below the files folder, but which isn't directly next to the files/usr/lib folder.

~/test $ ./clang-20 test.c -I$PREFIX/lib/clang/20/include -nodefaultlibs -lc

Maybe this happens because these files' relative paths to the clang binary are handled separately from the -DDEFAULT_SYSROOT setting, and maybe they are already set to relative paths by default, meaning that if the sysroot is copied or moved to a different path, the clang binary must be in a folder relative by ../lib to the lib folder always, regardless of other settings.

@MohammedKHC0
Copy link
Contributor

Hmm. So what do you think @finagolfin ?
Also @robertkirkman thanks for your testing. And yeah it seems like clang does already hardcode relative paths to the usr dir for the included files. But this does not matter if clang is copied into the correct structure test/usr/bin. Alongside with usr/lib (ex. Changing the entire termux prefix. Or maybe using the clang compiled for termux in a diffrent app)

@finagolfin
Copy link
Member Author

Finally tested this out locally, worked fine. Give me time to review the source a bit in the coming days and I will let you know, @MohammedKHC0.

@MohammedKHC0
Copy link
Contributor

Take your time! Honestly, I'm really amazed by how you all freely dedicate your time. When I submit a small patch, it's usually because I personally need it. But you guys? You not only enhance the software's quality, you also personally test the code. That kind of contribution truly exists only within the open source world.

@finagolfin finagolfin merged commit 5973285 into master Jul 27, 2025
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants