Skip to content

[Flang] Linker fails, big local array with SAVE attribute. #78948

Open
@kiranktp

Description

@kiranktp

[Flang] Linker fails, big local array with SAVE attribute.

Here is the reproducer:
cat -n repro.F90
1 Program test_linker
2 Call s()
3 Print '("ok")'
4 Contains
5 Subroutine s()
6 Real(kind(1.d0)),Save :: x(1:10**9)
7 End Subroutine s
8 End Program test_linker

$ flang-new repro.F90
/home/llvm-flang-src/install/lib/libFortranRuntime.a(unit.cpp.o): in function Fortran::runtime::io::CloseAllExternalUnits()': unit.cpp:(.text._ZN7Fortran7runtime2ioL21CloseAllExternalUnitsEv+0x8): relocation truncated to fit: R_X86_64_PC32 against .bss._ZN7Fortran7runtime2ioL11unitMapLockE'
unit.cpp:(.text._ZN7Fortran7runtime2ioL21CloseAllExternalUnitsEv+0x64): relocation truncated to fit: R_X86_64_PC32 against .bss._ZN7Fortran7runtime2ioL7unitMapE' unit.cpp:(.text._ZN7Fortran7runtime2ioL21CloseAllExternalUnitsEv+0x6b): relocation truncated to fit: R_X86_64_PC32 against .bss._ZN7Fortran7runtime2ioL11unitMapLockE'
unit.cpp:(.text._ZN7Fortran7runtime2ioL21CloseAllExternalUnitsEv+0x71): relocation truncated to fit: R_X86_64_PC32 against .bss._ZN7Fortran7runtime2ioL11unitMapLockE' unit.cpp:(.text._ZN7Fortran7runtime2ioL21CloseAllExternalUnitsEv+0x86): relocation truncated to fit: R_X86_64_PC32 against .bss._ZN7Fortran7runtime2ioL7unitMapE'
unit.cpp:(.text._ZN7Fortran7runtime2ioL21CloseAllExternalUnitsEv+0x92): relocation truncated to fit: R_X86_64_PC32 against .bss._ZN7Fortran7runtime2ioL7unitMapE' unit.cpp:(.text._ZN7Fortran7runtime2ioL21CloseAllExternalUnitsEv+0xa0): relocation truncated to fit: R_X86_64_PC32 against .bss._ZN7Fortran7runtime2ioL13defaultOutputE'
unit.cpp:(.text._ZN7Fortran7runtime2ioL21CloseAllExternalUnitsEv+0xab): relocation truncated to fit: R_X86_64_PC32 against .bss._ZN7Fortran7runtime2ioL12defaultInputE' unit.cpp:(.text._ZN7Fortran7runtime2ioL21CloseAllExternalUnitsEv+0xb6): relocation truncated to fit: R_X86_64_PC32 against .bss._ZN7Fortran7runtime2ioL11errorOutputE'
unit.cpp:(.text._ZN7Fortran7runtime2ioL21CloseAllExternalUnitsEv+0xc0): relocation truncated to fit: R_X86_64_PC32 against .bss._ZN7Fortran7runtime2ioL11unitMapLockE' /home/llvm-flang-src/install/lib/libFortranRuntime.a(unit.cpp.o): in function Fortran::runtime::io::ExternalFileUnit::CreateUnitMap() [clone .localalias]':
unit.cpp:(.text._ZN7Fortran7runtime2io16ExternalFileUnit13CreateUnitMapEv+0x1e6): additional relocation overflows omitted from the output
flang-new: error: linker command failed with exit code 1 (use -v to see invocation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorflang:runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions