Bug 2437216 - Using -ftrampoline-impl=heap leads to an undefined symbol error
Summary: Using -ftrampoline-impl=heap leads to an undefined symbol error
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2026-02-06 01:48 UTC by Nickolai Belakovski
Modified: 2026-02-09 13:52 UTC (History)
16 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2026-02-09 13:52:20 UTC
Type: Bug
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FC-3099 0 None None None 2026-02-06 08:38:02 UTC

Description Nickolai Belakovski 2026-02-06 01:48:56 UTC
Description of problem:
Apologies that this is against llvm-toolset, but I tried to find the right component via the interface and couldn't, so this seemed like the closest one. The actual component is gcc-toolset-14 (and gcc-toolset-15).

Below is a sample Fortran program that uses nested functions (which require trampolines):

```
module algorithm

    public :: algorithm_with_nested_function

    abstract interface

    subroutine OBJ()
    end subroutine OBJ

    end interface
    
    contains
    
    subroutine algorithm_with_nested_function()
        call nested_function()
        call evaluate(nested_function)
        contains
        
        subroutine nested_function()
            print *, "nested function"
        end subroutine nested_function
    
    end subroutine algorithm_with_nested_function

    subroutine evaluate(a_nested_function)
        procedure(OBJ) :: a_nested_function
        call a_nested_function()
    end subroutine evaluate
    
end module algorithm


program hello

use algorithm, only : algorithm_with_nested_function

call algorithm_with_nested_function()
print *, "DONE"

end program hello
```

Running `gfortran -ftrampoline-impl=heap file.f90` leads to the following error (note that this compiler option is new as of gfortran v14):

```
/opt/rh/gcc-toolset-14/root/usr/libexec/gcc/aarch64-redhat-linux/14/ld: /tmp/ccJ5xEMc.o: in function `__algorithm_MOD_algorithm_with_nested_function':
main.f90:(.text+0xb0): undefined reference to `__gcc_nested_func_ptr_created'
/opt/rh/gcc-toolset-14/root/usr/libexec/gcc/aarch64-redhat-linux/14/ld: main.f90:(.text+0xc8): undefined reference to `__gcc_nested_func_ptr_deleted'
```

Adding `-lgcc_eh` at the end makes the error go away and the program compiles and runs fine. It seems to me that the user shouldn't have to add -lgcc_eh at the end, the toolchain should figure this out, no?


Version-Release number of selected component (if applicable):


How reproducible:
Very


Steps to Reproduce:
1. Run redhat/ubi9 docker image
2. Create the above file as file.f90
3. dnf install -y gcc-toolset-14
4. scl enable gcc-toolset-14 bash
5. gfortran -ftrampoline-impl=heap file.f90
6. Observe the error
7. gfortran -ftrampoline-impl=heap file.f90 -lgcc_eh
8. Observe that it works

Actual results:


Expected results:


Additional info:
If this isn't the right place to report this please let me know and I'll try to find the right place to report it.

Comment 1 Nikita Popov 2026-02-06 08:35:33 UTC
Reassigning this to gcc (which contains gfortran) in case this is also relevant on Fedora, but if the issue is RHEL specific the right venue would be issues.redhat.com.

Comment 2 Jakub Jelinek 2026-02-09 12:42:38 UTC
Fedora is not affected, those symbols are in libgcc_s.so.1 since GCC 14.
Guess DTS needs to (if we want to support this there at all) provide the symbol in libgcc_s_nonshared.a or something similar, or include it in libgcc.a in addition to libgcc_eh.a for RHEL versions which don't support those symbols in libgcc_s.so.1.
But bet for GTS this needs to be filed in JIRA rather than bugzilla.

Comment 3 Siddhesh Poyarekar 2026-02-09 13:52:20 UTC
Not a bug in Fedora.  If you're a Red Hat customer, please file a support case so that this gets prioritized appropriately:

https://access.redhat.com/support/cases/

If you're seeing this on CentOS Stream, please file an issue here:

https://issues.redhat.com/

Thanks!


Note You need to log in before you can comment on or make changes to this bug.