Skip to content

LLD linker script parser accepts too much in input section wildcard patterns #81804

@mysterymath

Description

@mysterymath

We ran across an instance of strange parser behavior in LLD; it apparently is willing to accept the following as an input section wildcard:

*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.text*)) }

  PROVIDE_HIDDEN(__code_end = .)

There is a missing parenthesis after .text*; there should be three, not two. But LLD doesn't issue a diagnostic; it silently considers the all of the linker script up until the next paren as part of the pattern.

This appears to be considerably more lenient than GNU LD's wildcard pattern:
https://github.com/bminor/binutils-gdb/blob/363baa11378c6383eada19f6bc851fc7230c5dea/ld/ldlex.l#L95

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorlld:ELF

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions