Skip to content

Commit

Permalink
Avoid an assertion failure in alias.asm (#2738)
Browse files Browse the repository at this point in the history
Co-authored-by: Stephan T. Lavavej <[email protected]>
  • Loading branch information
barcharcraz and StephanTLavavej authored May 25, 2022
1 parent fc9232d commit 60decd0
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 55 deletions.
3 changes: 2 additions & 1 deletion stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ set(IMPLIB_SOURCES
${CMAKE_CURRENT_LIST_DIR}/src/syserror_import_lib.cpp
${CMAKE_CURRENT_LIST_DIR}/src/vector_algorithms.cpp
${CMAKE_CURRENT_LIST_DIR}/src/xonce2.cpp
${CMAKE_CURRENT_LIST_DIR}/src/alias.asm
${CMAKE_CURRENT_LIST_DIR}/src/alias_init_once_begin_initialize.asm
${CMAKE_CURRENT_LIST_DIR}/src/alias_init_once_complete.asm
)

# The following files are linked in msvcp140[d][_clr].dll.
Expand Down
3 changes: 2 additions & 1 deletion stl/msbuild/stl_base/stl.files.settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
<!-- Objs that exist in both libcpmt[d][01].lib and msvcprt[d].lib
(controlled by IncludeInLink and IncludeInImportLib). -->
<BuildFiles Include="
$(CrtRoot)\github\stl\src\alias.asm;
$(CrtRoot)\github\stl\src\alias_init_once_begin_initialize.asm;
$(CrtRoot)\github\stl\src\alias_init_once_complete.asm;
">
<BuildAs>asm</BuildAs>
<IncludeInLink>false</IncludeInLink>
Expand Down
53 changes: 0 additions & 53 deletions stl/src/alias.asm

This file was deleted.

26 changes: 26 additions & 0 deletions stl/src/alias_init_once_begin_initialize.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
; Copyright (c) Microsoft Corporation.
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

; weak symbol aliases

; This checks if we're in x64 mode (using ml64).
; Note that RAX isn't really an assembler symbol,
; and this check only works in the IFDEF direction.
; That is:
; IFDEF RAX
; meow
; ENDIF
; will expand to meow on only x64 systems, however:
; IFNDEF RAX
; meow
; ENDIF
; will expand to meow on _BOTH_ x64 and x86 systems.
IFDEF RAX
EXTERN __imp_InitOnceBeginInitialize : PROC
ALIAS <__imp___std_init_once_begin_initialize> = <__imp_InitOnceBeginInitialize>
ELSE
EXTERN __imp__InitOnceBeginInitialize@16 : PROC
ALIAS <__imp____std_init_once_begin_initialize@16> = <__imp__InitOnceBeginInitialize@16>
ENDIF

END
26 changes: 26 additions & 0 deletions stl/src/alias_init_once_complete.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
; Copyright (c) Microsoft Corporation.
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

; weak symbol aliases

; This checks if we're in x64 mode (using ml64).
; Note that RAX isn't really an assembler symbol,
; and this check only works in the IFDEF direction.
; That is:
; IFDEF RAX
; meow
; ENDIF
; will expand to meow on only x64 systems, however:
; IFNDEF RAX
; meow
; ENDIF
; will expand to meow on _BOTH_ x64 and x86 systems.
IFDEF RAX
EXTERN __imp_InitOnceComplete : PROC
ALIAS <__imp___std_init_once_complete> = <__imp_InitOnceComplete>
ELSE
EXTERN __imp__InitOnceComplete@12 : PROC
ALIAS <__imp____std_init_once_complete@12> = <__imp__InitOnceComplete@12>
ENDIF

END

0 comments on commit 60decd0

Please sign in to comment.