Issue 126051
Summary [flang] linker_flags.f90 fails with -DCLANG_DEFAULT_UNWINDLIB=libgcc
Labels flang:driver
Assignees
Reporter nikic
    ```
RUN: at line 14: /builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/redhat-linux-build/bin/flang -### -rtlib=compiler-rt --target=aarch64-linux-gnu /builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/test/Driver/Inputs/hello.f90 2>&1 | /usr/lib64/llvm20/bin/FileCheck /builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/test/Driver/linker-flags.f90 --check-prefixes=CHECK,UNIX,COMPILER-RT
+ /builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/redhat-linux-build/bin/flang -### -rtlib=compiler-rt --target=aarch64-linux-gnu /builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/test/Driver/Inputs/hello.f90
+ /usr/lib64/llvm20/bin/FileCheck /builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/test/Driver/linker-flags.f90 --check-prefixes=CHECK,UNIX,COMPILER-RT
/builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/test/Driver/linker-flags.f90:68:20: error: COMPILER-RT-NOT: excluded string found in input
! COMPILER-RT-NOT: "-lgcc_s"
                   ^
<stdin>:6:880: note: found here
 "/usr/bin/ld" "-EL" "--hash-style=gnu" "--build-id" "--eh-frame-hdr" "-m" "aarch64linux" "-dynamic-linker" "/lib/ld-linux-aarch64.so.1" "-o" "a.out" "/lib/../lib64/crt1.o" "/lib/../lib64/crti.o" "crtbegin.o" "-L/lib/../lib64" "-L/usr/lib/../lib64" "-L/lib" "-L/usr/lib" "/tmp/lit-tmp-5pv3rp85/hello-e5d40e.o" "-L/builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/redhat-linux-build/lib" "-lFortranRuntime" "-lFortranDecimal" "-lm" "/builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/redhat-linux-build/bin/../../../lib/clang/20/lib/aarch64-unknown-linux-gnu/libclang_rt.builtins.a" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "/builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/redhat-linux-build/bin/../../../lib/clang/20/lib/aarch64-unknown-linux-gnu/libclang_rt.builtins.a" "--as-needed" "-lgcc_s" "--no-as-needed" "crtend.o" "/lib/../lib64/crtn.o"
 ^~~~~~~~~

Input file: <stdin>
Check file: /builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/test/Driver/linker-flags.f90

-dump-input=help explains the following input dump.

Input was:
<<<<<<
        1: flang version 20.1.0 (Fedora 20.1.0~rc1-3.fc42) 
        2: Target: aarch64-unknown-linux-gnu 
        3: Thread model: posix 
        4: InstalledDir: /builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/redhat-linux-build/bin 
        5: "/builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/redhat-linux-build/bin/flang" "-fc1" "-triple" "aarch64-unknown-linux-gnu" "-emit-obj" "-mrelocation-model" "static" "-target-cpu" "generic" "-target-feature" "+outline-atomics" "-target-feature" "+v8a" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-resource-dir" "/builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/redhat-linux-build/bin/../../../lib/clang/20" "-mframe-pointer=non-leaf" "-o" "/tmp/lit-tmp-5pv3rp85/hello-e5d40e.o" "-x" "f95-cpp-input" "/builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/test/Driver/Inputs/hello.f90" 
        6:  "/usr/bin/ld" "-EL" "--hash-style=gnu" "--build-id" "--eh-frame-hdr" "-m" "aarch64linux" "-dynamic-linker" "/lib/ld-linux-aarch64.so.1" "-o" "a.out" "/lib/../lib64/crt1.o" "/lib/../lib64/crti.o" "crtbegin.o" "-L/lib/../lib64" "-L/usr/lib/../lib64" "-L/lib" "-L/usr/lib" "/tmp/lit-tmp-5pv3rp85/hello-e5d40e.o" "-L/builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/redhat-linux-build/lib" "-lFortranRuntime" "-lFortranDecimal" "-lm" "/builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/redhat-linux-build/bin/../../../lib/clang/20/lib/aarch64-unknown-linux-gnu/libclang_rt.builtins.a" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "/builddir/build/BUILD/flang-20.1.0_rc1-build/llvm-project-20.1.0-rc1.src/flang/redhat-linux-build/bin/../../../lib/clang/20/lib/aarch64-unknown-linux-gnu/libclang_rt.builtins.a" "--as-needed" "-lgcc_s" "--no-as-needed" "crtend.o" "/lib/../lib64/crtn.o" 
not:68 !~~~~~~~~ error: no match expected
>>>>>>
```

-lgcc_s gets pulled in via the unwind library here.

I'm not really sure what do do about this one. It looks like flang doesn't expose the `--unwindlib` flag from the driver. If I understand correctly, fortran doesn't have exceptions, so possibly it doesn't need to link an unwind library at all? I think it should be either that, or flang should expose --unwindlib.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to