Skip to content

Commit c599f4f

Browse files
committed
[MERGE #2487 @obastemur] xplat: build-time fixes and enabling runtime features
Merge pull request #2487 from obastemur:osx_fixes_5 - xplat: library visibility changes [/cc nodejs-chakracore] - osx: enable temp disabled profiling/tracking features - osx: make 10.9 default minimum target [/cc nodejs-chakracore] - xplat: do not static link to libstdc++ (shared)
2 parents 1a7734a + 6a0a7e4 commit c599f4f

File tree

9 files changed

+28
-30
lines changed

9 files changed

+28
-30
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ elseif(CC_TARGET_OS_OSX)
201201
if(NOT CC_XCODE_PROJECT)
202202
set(OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET} CC")
203203
if (${OSX_DEPLOYMENT_TARGET} STREQUAL " CC")
204-
set(OSX_DEPLOYMENT_TARGET "10.7")
205-
add_compile_options(-mmacosx-version-min=10.7)
204+
set(OSX_DEPLOYMENT_TARGET "10.9")
205+
add_compile_options(-mmacosx-version-min=10.9)
206206
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
207-
-mmacosx-version-min=10.7")
207+
-mmacosx-version-min=10.9 -std=gnu99")
208208
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
209-
-mmacosx-version-min=10.7")
209+
-mmacosx-version-min=10.9 -std=gnu++11")
210210
else()
211211
set(OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}")
212212
message(WARNING "!! macOS Deployment Target was set to $ENV{MACOSX_DEPLOYMENT_TARGET}. Using it as is.")

bin/ChakraCore/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
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/Codex/Utf8Codex.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
typedef WCHAR char16;
2121
#define _u(s) L##s
2222
#else
23-
typedef char16_t char16;
2423
#define _u(s) u##s
2524
#endif
2625

@@ -164,7 +163,7 @@ namespace utf8
164163
// special cases ASCII to avoid a call the most common characters.
165164
LPUTF8 EncodeFull(char16 ch, __out_ecount(3) LPUTF8 ptr);
166165

167-
// Encode a surrogate pair into a utf8 sequence
166+
// Encode a surrogate pair into a utf8 sequence
168167
LPUTF8 EncodeSurrogatePair(char16 surrogateHigh, char16 surrogateLow, __out_ecount(4) LPUTF8 ptr);
169168

170169
// Encode ch into a UTF8 sequence ignoring surrogate pairs (which are encoded as two
@@ -190,7 +189,7 @@ namespace utf8
190189
else if (ch < 0xD800 || (ch >= 0xE000 && ch <= 0xFFFF))
191190
{
192191
return EncodeFull(ch, ptr);
193-
}
192+
}
194193

195194
// We're now decoding a surrogate pair. If the input is malformed (eg. low surrogate is absent)
196195
// we'll instead encode the unicode replacement character as utf8
@@ -199,13 +198,13 @@ namespace utf8
199198
char16 surrogateHigh = ch;
200199
char16 surrogateLow = **source;
201200

202-
// Validate that the surrogate code units are within the appropriate
201+
// Validate that the surrogate code units are within the appropriate
203202
// ranges for high and low surrogates
204203
if ((surrogateHigh >= 0xD800 && surrogateHigh <= 0xDBFF) &&
205204
(surrogateLow >= 0xDC00 && surrogateLow <= 0xDFFF))
206205
{
207206
LPUTF8 retptr = EncodeSurrogatePair(surrogateHigh, surrogateLow, ptr);
208-
207+
209208
// SAL analysis gets confused if we call EncodeSurrogatePair after
210209
// modifying cch
211210

lib/Common/CommonDefines.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -482,14 +482,10 @@
482482
#define PROFILE_BAILOUT_RECORD_MEMORY
483483
#define MEMSPECT_TRACKING
484484

485-
// xplat-todo: Depends on C++ type-info
486-
// enable later on non-VC++ compilers
487-
#ifndef __APPLE__
488485
#define PROFILE_RECYCLER_ALLOC
489486
// Needs to compile in debug mode
490487
// Just needs strings converted
491488
#define PROFILE_DICTIONARY 1
492-
#endif
493489

494490
#define PROFILE_STRINGS
495491

@@ -523,12 +519,9 @@
523519
#endif
524520
#endif
525521

526-
// xplat: on apple looks typeid(char16_t) does not work, hit error: Undefined symbols for architecture x86_64: "typeinfo for char16_t"
527-
#ifndef __APPLE__
528522
#define HEAP_TRACK_ALLOC
529523
#define CHECK_MEMORY_LEAK
530524
#define LEAK_REPORT
531-
#endif
532525

533526
#define PROJECTION_METADATA_TRACE
534527
#define ERROR_TRACE
@@ -772,3 +765,9 @@
772765
#endif
773766
#endif // __APPLE__
774767
#endif // THREAD_LOCAL
768+
769+
#ifndef _WIN32
770+
#define NO_EXPORT __attribute__((visibility("hidden")))
771+
#else
772+
#define NO_EXPORT
773+
#endif

lib/Common/CommonPal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ __forceinline void __int2c()
103103
#include "inc/rt/no_sal2.h"
104104
#include "inc/rt/oaidl.h"
105105

106-
typedef char16_t char16;
107106
#define _u(s) u##s
108107

109108
typedef GUID UUID;

lib/Common/Core/CommonTypedefs.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
typedef WCHAR char16;
1111
#define _u(s) L##s
1212
#else
13-
typedef char16_t char16;
1413
#define _u(s) u##s
1514
#endif
1615

1716
typedef char16 wchar;
1817
typedef unsigned int uint;
1918
typedef unsigned short ushort;
2019

21-
// Use of ulong is not allowed in ChakraCore- uint32 should be used instead since
20+
// Use of ulong is not allowed in ChakraCore- uint32 should be used instead since
2221
// it's our cross-platform 32 bit integer value. However, legacy code in ChakraFull
2322
// still depends on ulong so it's allowed for full builds.
2423
#ifdef NTBUILD
@@ -62,4 +61,3 @@ namespace Js
6261
{
6362
typedef uint32 LocalFunctionId;
6463
};
65-

lib/Common/Memory/Allocator.h

Lines changed: 9 additions & 9 deletions
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);

lib/Runtime/PlatformAgnostic/RuntimePlatformAgnosticPch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#ifdef _WIN32
88
#include "CommonDefines.h"
99
#include "CommonMin.h"
10+
#else
11+
#include "pal.h"
1012
#endif
1113

1214
#ifdef _MSC_VER

pal/inc/pal_mstypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ typedef LONG_PTR LPARAM;
558558
typedef unsigned short char16_t;
559559
#endif // __cplusplus
560560

561+
typedef char16_t char16;
561562
typedef char16_t WCHAR;
562-
#define WCHAR_IS_CHAR16_T 1
563563

564564
#ifdef PAL_STDCPP_COMPAT
565565

0 commit comments

Comments
 (0)