[all-commits] [llvm/llvm-project] 551e20: [ELF] Reject error-prone meta characters in input ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Mar 6 17:20:21 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 551e20d190868fe47f8efbfd1dbf38191cc2c95d
      https://github.com/llvm/llvm-project/commit/551e20d190868fe47f8efbfd1dbf38191cc2c95d
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-03-06 (Wed, 06 Mar 2024)

  Changed paths:
    M lld/ELF/ScriptParser.cpp
    M lld/test/ELF/linkerscript/wildcards.s

  Log Message:
  -----------
  [ELF] Reject error-prone meta characters in input section description

The lexer is overly permissive. When parsing file patterns in an input
section description and there is a missing `)`, we would accept many
non-sensible tokens (e.g. `}`) as patterns, leading to confusion, e.g.
`*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.text*)) } PROVIDE_HIDDEN(__code_end = .)`
(#81804).

Ideally, the lexer should be stateful to report more errors like GNU ld
and get rid of hacks like `ScriptLexer::maybeSplitExpr`, but that would
require a large rewrite of the lexer. For now, just reject certain
non-wildcard meta characters to detect common mistakes.

Pull Request: https://github.com/llvm/llvm-project/pull/84130



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list