Skip to content

Commit 11a6851

Browse files
committed
xplat: library visibility changes
1 parent a4b51b4 commit 11a6851

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

bin/ChakraCore/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ target_include_directories (
5858
${CHAKRACORE_SOURCE_DIR}/lib/Parser
5959
${CHAKRACORE_SOURCE_DIR}/lib/Jsrt
6060
${wasm_includes}
61+
"-fvisibility=hidden"
6162
)
6263

6364
if (NOT STATIC_LIBRARY)

lib/Common/CommonDefines.h

+6
Original file line numberDiff line numberDiff line change
@@ -770,3 +770,9 @@
770770
#endif
771771
#endif // __APPLE__
772772
#endif // THREAD_LOCAL
773+
774+
#ifndef _WIN32
775+
#define NO_EXPORT __attribute__((visibility("hidden")))
776+
#else
777+
#define NO_EXPORT
778+
#endif

lib/Common/Memory/Allocator.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ void AssertValue(void * mem, T value, uint byteCount)
369369
#ifndef __PLACEMENT_NEW_INLINE
370370
#define __PLACEMENT_NEW_INLINE
371371

372-
_Ret_notnull_
372+
NO_EXPORT _Ret_notnull_
373373
inline void * __cdecl
374374
operator new(
375375
DECLSPEC_GUARD_OVERFLOW size_t byteSize,
@@ -379,7 +379,7 @@ _In_ void * previousAllocation) throw()
379379
}
380380

381381

382-
inline void __cdecl
382+
NO_EXPORT inline void __cdecl
383383
operator delete(
384384
void * allocationToFree, // Allocation to free
385385
void * previousAllocation // Previously allocated memory
@@ -394,7 +394,7 @@ void * previousAllocation // Previously allocated memory
394394
// throwing operator new overrides
395395
//----------------------------------------
396396
template <typename TAllocator>
397-
_Ret_notnull_ void * __cdecl
397+
NO_EXPORT _Ret_notnull_ void * __cdecl
398398
operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char * (TAllocator::*AllocFunc)(size_t))
399399
{
400400
AssertCanHandleOutOfMemory();
@@ -405,7 +405,7 @@ operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char *
405405
}
406406

407407
template <typename TAllocator>
408-
_Ret_notnull_ inline void * __cdecl
408+
NO_EXPORT _Ret_notnull_ inline void * __cdecl
409409
operator new[](DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char * (TAllocator::*AllocFunc)(size_t))
410410
{
411411
AssertCanHandleOutOfMemory();
@@ -416,7 +416,7 @@ operator new[](DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char
416416
}
417417

418418
template <typename TAllocator>
419-
_Ret_notnull_ inline void * __cdecl
419+
NO_EXPORT _Ret_notnull_ inline void * __cdecl
420420
operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char * (TAllocator::*AllocFunc)(size_t), DECLSPEC_GUARD_OVERFLOW size_t plusSize)
421421
{
422422
AssertCanHandleOutOfMemory();
@@ -433,7 +433,7 @@ operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char *
433433
// nothrow operator new overrides
434434
//----------------------------------------
435435
template <typename TAllocator>
436-
_Ret_maybenull_ inline void * __cdecl
436+
NO_EXPORT _Ret_maybenull_ inline void * __cdecl
437437
operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool nothrow, char * (TAllocator::*AllocFunc)(size_t))
438438
{
439439
Assert(nothrow);
@@ -444,7 +444,7 @@ operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool n
444444

445445

446446
template <typename TAllocator>
447-
_Ret_maybenull_ inline void * __cdecl
447+
NO_EXPORT _Ret_maybenull_ inline void * __cdecl
448448
operator new[](DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool nothrow, char * (TAllocator::*AllocFunc)(size_t))
449449
{
450450
Assert(nothrow);
@@ -455,7 +455,7 @@ operator new[](DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool
455455

456456

457457
template <typename TAllocator>
458-
_Ret_maybenull_ inline void * __cdecl
458+
NO_EXPORT _Ret_maybenull_ inline void * __cdecl
459459
operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool nothrow, char * (TAllocator::*AllocFunc)(size_t), DECLSPEC_GUARD_OVERFLOW size_t plusSize)
460460
{
461461
Assert(nothrow);
@@ -469,7 +469,7 @@ operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool n
469469

470470

471471
template <typename TAllocator>
472-
_Ret_maybenull_ inline void * __cdecl
472+
NO_EXPORT _Ret_maybenull_ inline void * __cdecl
473473
operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool nothrow, char * (TAllocator::*AllocFunc)(size_t), DECLSPEC_GUARD_OVERFLOW size_t plusSize, bool prefix)
474474
{
475475
Assert(nothrow);

0 commit comments

Comments
 (0)