Skip to content

[LLD] Invalid 'there is a cycle in linker script INCLUDEs' error #93947

@partaror

Description

@partaror

LLD incorrectly reports 'there is a cycle in linker script INCLUDEs' error when a linker script is included multiple times (but there is no cycle). Reproducible example:

#!/usr/bin/env bash

cat > incrementDotBy100.t \EOF
  . = . + 100;
EOF

cat >1.t <<\EOF
SECTIONS {
  FOO : {
    *(*foo*)
    INCLUDE incrementDotBy100.t
  }
  BAR : {
    *(*bar*)
    INCLUDE incrementDotBy100.t
  }
}
EOF

touch 1.c
clang-15 -o 1.o 1.c -c
ld.lld -o 1.elf 1.o -T 1.t

Output:

ld.lld: error: 1.t:8: there is a cycle in linker script INCLUDEs
>>>     INCLUDE incrementDotBy100.t
>>> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions