[all-commits] [llvm/llvm-project] e2e132: [LLD][COFF] Set OrdinalBase to 1 for export table

alvinhochun via All-commits all-commits at lists.llvm.org
Mon Oct 3 00:59:28 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e2e132c5d967bb762fa00267337ed47af0163e84
      https://github.com/llvm/llvm-project/commit/e2e132c5d967bb762fa00267337ed47af0163e84
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-10-03 (Mon, 03 Oct 2022)

  Changed paths:
    M lld/COFF/DLL.cpp
    M lld/test/COFF/directives.s
    M lld/test/COFF/dll.test
    M lld/test/COFF/exclude-symbols-embedded.s
    M lld/test/COFF/exclude-symbols.s
    M lld/test/COFF/export-all.s
    M lld/test/COFF/export-arm64.yaml
    M lld/test/COFF/export-armnt.yaml
    M lld/test/COFF/export-exe.test
    M lld/test/COFF/export.test
    M lld/test/COFF/export32.test
    M lld/test/COFF/icf-xdata.s
    M lld/test/COFF/imports-gnu-autoexport.s
    M lld/test/COFF/includeoptional-export.s
    M lld/test/COFF/lto-icf.ll

  Log Message:
  -----------
  [LLD][COFF] Set OrdinalBase to 1 for export table

Before this, LLD sets OrdinalBase to 0, which deviates from usual
practices. This technically would allow LLD to export a symbol using
ordinal 0, however LLD never use export ordinal 0, which results in
binaries with export tables always having an empty export at ordinal 0.

This change makes LLD set OrdinalBase to 1 and not create the empty
export with ordinal 0, which makes its behaviour more in line with both
the MSVC linker and the GNU linker.

Reviewed By: mstorsjo

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


  Commit: 0ce4f57052c393b05d9896bb996de2b76855a21b
      https://github.com/llvm/llvm-project/commit/0ce4f57052c393b05d9896bb996de2b76855a21b
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-10-03 (Mon, 03 Oct 2022)

  Changed paths:
    M lld/COFF/DLL.cpp

  Log Message:
  -----------
  [LLD][COFF] Reduce chance of symbol name collision with delay-load

Delay-loaded imports creats a load thunk with a symbol name. Before this
change, the name uses a `__imp_load_` prefix. On the other hand, normal
import uses the `__imp_` prefix for the import address pointer. If an
import symbol named `load_func` is imported normally and another named
`func` is imported using delay-load, this can cause a symbol name
collision.

This patch changes delay-load imports to use `__imp___load_` prefix.
Because it is less likely for normal imports to have a name starting in
`__load_` this should reduce the chance of a name collision.

Reviewed By: mstorsjo

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


  Commit: d90633a74befa257f8617c4784d74a27fd287720
      https://github.com/llvm/llvm-project/commit/d90633a74befa257f8617c4784d74a27fd287720
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-10-03 (Mon, 03 Oct 2022)

  Changed paths:
    M clang/lib/Basic/Targets.cpp
    M clang/test/Preprocessor/init-x86.c
    M clang/test/Preprocessor/init.c

  Log Message:
  -----------
  [Clang][MinGW][cygwin] Fix __declspec with -fdeclspec enabled

Fixes https://github.com/llvm/llvm-project/issues/49958

Reviewed By: rnk

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


Compare: https://github.com/llvm/llvm-project/compare/dd9dfb57daec...d90633a74bef


More information about the All-commits mailing list