mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-26 17:24:02 +00:00
Unexport even more symbols (#13214)
* system/gc: don't export markStackAndRegisters * compiler/cgen: unexport internal symbols As these functions are Nim-specific walkaround against C's optimization schemes, they don't serve any purpose being exported. * compiler/cgen: don't export global var unless marked * compiler/ccgthreadvars: don't export threadvar unless marked * tests/dll/visibility: also check for exports This ensure that these changes don't break manual exports. * compiler/cgen: hide all variables created for constants * compiler/ccgtypes: don't export RTTI variables * compiler/ccgexprs: make all complex const static * nimbase.h: fix export for windows * compiler/cgen, ccgthreadvars: export variables correctly For C/C++ variables, `extern` means that the variable is defined in an another unit. Added a new N_LIB_EXPORT_VAR to correctly export variables.
This commit is contained in:
@@ -182,10 +182,11 @@ __AVR__
|
||||
# define N_SAFECALL_PTR(rettype, name) rettype (__stdcall *name)
|
||||
|
||||
# ifdef __cplusplus
|
||||
# define N_LIB_EXPORT extern "C" __declspec(dllexport)
|
||||
# define N_LIB_EXPORT NIM_EXTERNC __declspec(dllexport)
|
||||
# else
|
||||
# define N_LIB_EXPORT extern __declspec(dllexport)
|
||||
# define N_LIB_EXPORT NIM_EXTERNC __declspec(dllexport)
|
||||
# endif
|
||||
# define N_LIB_EXPORT_VAR __declspec(dllexport)
|
||||
# define N_LIB_IMPORT extern __declspec(dllimport)
|
||||
#else
|
||||
# define N_LIB_PRIVATE __attribute__((visibility("hidden")))
|
||||
@@ -215,6 +216,7 @@ __AVR__
|
||||
# define N_SAFECALL_PTR(rettype, name) rettype (*name)
|
||||
# endif
|
||||
# define N_LIB_EXPORT NIM_EXTERNC __attribute__((visibility("default")))
|
||||
# define N_LIB_EXPORT_VAR __attribute__((visibility("default")))
|
||||
# define N_LIB_IMPORT extern
|
||||
#endif
|
||||
|
||||
|
||||
@@ -682,7 +682,7 @@ proc gcMark(gch: var GcHeap, p: pointer) {.inline.} =
|
||||
`CLANG_NO_SANITIZE_ADDRESS` in `lib/nimbase.h`.
|
||||
]#
|
||||
proc markStackAndRegisters(gch: var GcHeap) {.noinline, cdecl,
|
||||
codegenDecl: "CLANG_NO_SANITIZE_ADDRESS $# $#$#".} =
|
||||
codegenDecl: "CLANG_NO_SANITIZE_ADDRESS N_LIB_PRIVATE $# $#$#".} =
|
||||
forEachStackSlot(gch, gcMark)
|
||||
|
||||
proc collectZCT(gch: var GcHeap): bool =
|
||||
|
||||
Reference in New Issue
Block a user