[all-commits] [llvm/llvm-project] 9a2b69: [llvm-rc] [test] Fix the windres-preproc test with...

Mateusz Mikuła via All-commits all-commits at lists.llvm.org
Tue Sep 20 01:03:26 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a2b69764e115501785b498e0c1e871f2600c908
      https://github.com/llvm/llvm-project/commit/9a2b69764e115501785b498e0c1e871f2600c908
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-09-20 (Tue, 20 Sep 2022)

  Changed paths:
    M llvm/test/tools/llvm-rc/windres-preproc.test

  Log Message:
  -----------
  [llvm-rc] [test] Fix the windres-preproc test with other mingw triple forms. NFC.

When invoking the preprocessor, llvm-windres produces a mingw
triple; if the llvm default target triple is a mingw target, it
is used as is - if not, a mingw style triple is generated.

Relax the testcase, to not strictly require "w64" as vendor (allow
the vendor field to be missing entirely), and allow both
"mingw32" and "windows-gnu" as OS/environment (where both forms are
common, while the latter is the normalized form).

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


  Commit: 9509f4e6578b78b6380a07c0b1c846b9c0d1682a
      https://github.com/llvm/llvm-project/commit/9509f4e6578b78b6380a07c0b1c846b9c0d1682a
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-09-20 (Tue, 20 Sep 2022)

  Changed paths:
    M lld/COFF/Writer.cpp
    M lld/test/COFF/symtab.test

  Log Message:
  -----------
  [LLD][COFF] Improve symbol table info for import thunk

Import thunks themselves contain a jump or branch, which is code by
nature. Therefore the import thunk symbol should be marked as function
type in the symbol table to help with debugging.

The `__imp_` import symbol associated to the import thunk is also useful
for debugging. However, when the import symbol isn't directly referenced
outside of the import thunk, it doesn't normally get added to the symbol
table. This change teaches LLD to add the import symbol explicitly.

Reviewed By: mstorsjo

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


  Commit: 365d0a5cd867cdf414b70c9f4fd5122146287b01
      https://github.com/llvm/llvm-project/commit/365d0a5cd867cdf414b70c9f4fd5122146287b01
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-09-20 (Tue, 20 Sep 2022)

  Changed paths:
    M lld/COFF/Writer.cpp
    A lld/test/COFF/guard-warnings.s

  Log Message:
  -----------
  [LLD][COFF] Add load config checks to warn if incorrect for CFGuard

Control Flow Guard requires specific flags and VA's be included in the
load config directory to be functional. In case CFGuard is enabled via
linker flags, we can check to make sure this is the case and give the
user a warning if otherwise.

MSVC provides a proper `_load_config_used` by default, so this is more
relevant for the MinGW target in which current versions of mingw-w64
does not provide this symbol.

The checks (only if CFGuard is enabled) include:

- The `_load_config_used` struct shall exist.
- Alignment of the `_load_config_used` struct (shall be aligned to
  pointer size.)
- The `_load_config_used` struct shall be large enough to contain the
  required fields.
- The values of the following fields are checked against the expected
  values:
  - GuardCFFunctionTable
  - GuardCFFunctionCount
  - GuardFlags
  - GuardAddressTakenIatEntryTable
  - GuardAddressTakenIatEntryCount
  - GuardLongJumpTargetTable
  - GuardLongJumpTargetCount
  - GuardEHContinuationTable
  - GuardEHContinuationCount

Reviewed By: rnk

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


  Commit: 4f30c5808a49ba85b052cb65bbe7b34109187bad
      https://github.com/llvm/llvm-project/commit/4f30c5808a49ba85b052cb65bbe7b34109187bad
  Author: Mateusz Mikuła <mati865 at gmail.com>
  Date:   2022-09-20 (Tue, 20 Sep 2022)

  Changed paths:
    M llvm/lib/Analysis/TargetLibraryInfo.cpp

  Log Message:
  -----------
  [TargetLibraryInfo] Mark memrchr as unavailable on Windows

Otherwise LLVM will optimise strrchr into memrchr on Windows resulting in linker error:
```
$ cat memrchr_test.c
int main(int argc, char **argv) {
    return (long)strrchr("KkMm", argv[argc-1][0]);
}

$ clang memrchr_test.c -O
memrchr_test.c:3:12: warning: cast to smaller integer type 'long' from 'char *' [-Wpointer-to-int-cast]
    return (long)strrchr("KkMm", argv[argc-1][0]);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
ld.lld: error: undefined symbol: memrchr
>>> referenced by D:/msys64/tmp/memrchr_test-e7aabd.o:(main)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

Example taken from MSYS2 Discord and tested with windows-gnu target.

Reviewed By: aeubanks

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


Compare: https://github.com/llvm/llvm-project/compare/a7d2409bac7f...4f30c5808a49


More information about the All-commits mailing list