[all-commits] [llvm/llvm-project] 885d7b: [compiler-rt] [builtins] Remove unused/misnamed x8...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Fri Sep 1 09:44:41 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 885d7b759b5c166c07c07f4c58c6e0ba110fb0c2
  Author: Martin Storsjö <martin at martin.st>
  Date:   2023-09-01 (Fri, 01 Sep 2023)

  Changed paths:
    M compiler-rt/lib/builtins/CMakeLists.txt
    R compiler-rt/lib/builtins/i386/chkstk.S
    M compiler-rt/lib/builtins/i386/chkstk2.S
    M compiler-rt/lib/builtins/x86_64/chkstk.S
    R compiler-rt/lib/builtins/x86_64/chkstk2.S

  Log Message:
  [compiler-rt] [builtins] Remove unused/misnamed x86 chkstk functions

For both MSVC and MinGW targets, the compiler generates calls to
functions for probing the stack, in functions that allocate a larger
amount of stack space.

The exact behaviour of these functions differ per architecture (some
decrement the stack, some actually decrement the stack pointer,
some only probe the stack). In MSVC mode, the compiler always
generates calls to a symbol named "__chkstk". In MinGW mode, the
symbol is named "__alloca" on i386 and "___chkstk_ms" on x86_64,
but the functions behave exactly the same as their MSVC counterparts
despite the differing names.

(On i386, these names are the raw symbol names - if considering
a C level function name with the extra implicit leading underscore,
they would be called "_chkstk" and "_alloca".)

Remove the misleading duplicate and unused functions. These were
added in fbfed869106cc9c9cad7538db5e65bcd24f4d92e /
c27de5b2790b65394c50ba13fab319995dbf5956 (adding "___chkstk_ms"
for both architectures, even if that symbol name only was used
on x86_64) and 40eb83ba56ba9c1d2e6de44deacf889ac0143cf7
(adding "__alloca" and "___chkstk", even if the former only was
used on i386, and the latter seeming like a misspelled form of
the MSVC function, with three underscores instead of two).

The x86_64 "___chkstk" was doubly surprising as that function had
the same behaviour as the function used on i386, while the
"__chkstk" that MSVC emitted calls to should behave exactly like
the preexisting "___chkstk_ms".

Remove the unused functions, and rename the misspelled MSVC-like
symbols to the correct name that MSVC mode actually uses.

Note that these files aren't assembled at all when building
compiler-rt builtins in MSVC mode, as they are expected to be
provided by MSVC libraries when building code in MSVC mode.

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

  Commit: 1f9eff100ce8faea1284d68b779d844c6e019b77
  Author: Martin Storsjö <martin at martin.st>
  Date:   2023-09-01 (Fri, 01 Sep 2023)

  Changed paths:
    M compiler-rt/lib/builtins/CMakeLists.txt
    A compiler-rt/lib/builtins/i386/chkstk.S
    R compiler-rt/lib/builtins/i386/chkstk2.S

  Log Message:
  [compiler-rt] Rename the now lone i386/chkstk2.S to i386/chkstk.S

This step was omitted from the previous commit,
885d7b759b5c166c07c07f4c58c6e0ba110fb0c2, for clarity.

Compare: https://github.com/llvm/llvm-project/compare/95062d74676b...1f9eff100ce8

More information about the All-commits mailing list