[all-commits] [llvm/llvm-project] 8c3641: [ELF] Change -z unknown from error to warning

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Nov 30 11:06:42 PST 2021

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8c3641d03ec0cb0e8730cad349b54d67581b4c73
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-11-30 (Tue, 30 Nov 2021)

  Changed paths:
    M lld/ELF/Driver.cpp
    M lld/test/ELF/driver.test

  Log Message:
  [ELF] Change -z unknown from error to warning

There is a trend of having more optional options (usually security
hardening related) like -z cet-report=, -z bti-report=, -z force-bti.
If ld.lld 14.0.0 uses a warning, in 15/16/17/... timeframe when people
add new options to software, they can worry less about linker errors on ld.lld 14.0.0.

In some cases `-z foo` does essential work where a silent ignore can be
problematic, but the user has received a warning. From my observation, the
doing-essential-work `-z foo` is much fewer than the converse. In addition,
the user who cares can use `--fatal-warnings` (Note: GNU ld doesn't upgrade warnings to errors).
It is unclear whether we need something like `clang -Wunknown-warning-option`.

If we ever run into unfortunate transition like `-z start-stop-gc`, the
affected software (e.g. ldc is a compiler which passes linker options to the underlying ld)
can blindly add the `-z` option, without worrying it may cause a linker error to LLD 14.0.0.

Reviewed By: jrtc27, peter.smith

Differential Revision: https://reviews.llvm.org/D114748

More information about the All-commits mailing list