Skip to content

Commit

Permalink
Make installer /Gz compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Mar 20, 2020
1 parent 4fc15c2 commit 2264fa0
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 21 deletions.
4 changes: 4 additions & 0 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ if (MSVC)
add_compile_options(/ZH:SHA_256) # use SHA256 for generating hashes of compiler processed source files.
add_compile_options(/source-charset:utf-8) # Force MSVC to compile source as UTF-8.

if (CLR_CMAKE_HOST_ARCH_I386)
add_compile_options(/Gz)
endif (CLR_CMAKE_HOST_ARCH_I386)

add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/GL>)
add_compile_options($<$<OR:$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>,$<CONFIG:Checked>>:/O1>)

Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ endif (CLR_CMAKE_HOST_WIN32)

if(MSVC)
set(CMAKE_CXX_STANDARD_LIBRARIES "") # do not link against standard win32 libs i.e. kernel32, uuid, user32, etc.
if (CLR_CMAKE_HOST_ARCH_I386)
add_compile_options(/Gz)
endif (CLR_CMAKE_HOST_ARCH_I386)
endif (MSVC)

# Set commonly used directory names
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake)
set(INC_PLATFORM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/Common/Platform)
if (CLR_CMAKE_TARGET_WIN32)
add_definitions(-DWINDOWS)
if (CLR_CMAKE_HOST_ARCH_I386)
add_compile_options(/Gz)
endif (CLR_CMAKE_HOST_ARCH_I386)
endif()

# Compile options
Expand Down
2 changes: 1 addition & 1 deletion src/installer/corehost/cli/apphost/apphost.windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace
{
pal::string_t g_buffered_errors;

void buffering_trace_writer(const pal::char_t* message)
void __cdecl buffering_trace_writer(const pal::char_t* message)
{
// Add to buffer for later use.
g_buffered_errors.append(message).append(_X("\n"));
Expand Down
2 changes: 1 addition & 1 deletion src/installer/corehost/cli/hostmisc/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace trace
void println();
void flush();

typedef void (*error_writer_fn)(const pal::char_t* message);
typedef void (__cdecl *error_writer_fn)(const pal::char_t* message);

// Sets a callback which is called whenever error is to be written
// The setting is per-thread (thread local). If no error writer is set for a given thread
Expand Down
2 changes: 1 addition & 1 deletion src/installer/corehost/cli/hostmisc/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bool test_only_getenv(const pal::char_t* name, pal::string_t* recv);
class propagate_error_writer_t
{
public:
typedef trace::error_writer_fn(*set_error_writer_fn)(trace::error_writer_fn error_writer);
typedef trace::error_writer_fn(__cdecl *set_error_writer_fn)(trace::error_writer_fn error_writer);

private:
set_error_writer_fn m_set_error_writer;
Expand Down
12 changes: 6 additions & 6 deletions src/installer/corehost/cli/hostpolicy/hostpolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace
std::atomic<bool> g_context_initializing(false);
std::condition_variable g_context_initializing_cv;

int create_coreclr()
int HOSTPOLICY_CALLTYPE create_coreclr()
{
int rc;
{
Expand Down Expand Up @@ -266,7 +266,7 @@ int run_app_for_context(
return exit_code;
}

int run_app(const int argc, const pal::char_t *argv[])
int HOSTPOLICY_CALLTYPE run_app(const int argc, const pal::char_t *argv[])
{
const std::shared_ptr<hostpolicy_context_t> context = get_hostpolicy_context(/*require_runtime*/ true);
if (context == nullptr)
Expand Down Expand Up @@ -439,7 +439,7 @@ int corehost_libhost_init(const hostpolicy_init_t &hostpolicy_init, const pal::s

namespace
{
int get_delegate(coreclr_delegate_type type, void **delegate)
int HOSTPOLICY_CALLTYPE get_delegate(coreclr_delegate_type type, void **delegate)
{
if (delegate == nullptr)
return StatusCode::InvalidArgFailure;
Expand Down Expand Up @@ -492,7 +492,7 @@ namespace
}
}

int get_property(const pal::char_t *key, const pal::char_t **value)
int HOSTPOLICY_CALLTYPE get_property(const pal::char_t *key, const pal::char_t **value)
{
if (key == nullptr)
return StatusCode::InvalidArgFailure;
Expand All @@ -507,7 +507,7 @@ namespace
return StatusCode::Success;
}

int set_property(const pal::char_t *key, const pal::char_t *value)
int HOSTPOLICY_CALLTYPE set_property(const pal::char_t *key, const pal::char_t *value)
{
if (key == nullptr)
return StatusCode::InvalidArgFailure;
Expand All @@ -531,7 +531,7 @@ namespace
return StatusCode::Success;
}

int get_properties(size_t * count, const pal::char_t **keys, const pal::char_t **values)
int HOSTPOLICY_CALLTYPE get_properties(size_t * count, const pal::char_t **keys, const pal::char_t **values)
{
if (count == nullptr)
return StatusCode::InvalidArgFailure;
Expand Down
4 changes: 2 additions & 2 deletions src/installer/corehost/cli/ijwhost/ijwthunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace
bootstrap_thunk_chunk* g_pVtableBootstrapThunkChunkList;

// We swallow the trace messages so we don't output to a stderr of a process that we do not own unless tracing is enabled.
void swallow_trace(const pal::char_t* msg)
void __cdecl swallow_trace(const pal::char_t* msg)
{
(void)msg;
}
Expand Down Expand Up @@ -187,4 +187,4 @@ bool are_thunks_installed_for_module(pal::dll_t instance)
}

return false;
}
}
2 changes: 1 addition & 1 deletion src/installer/corehost/cli/nethost/nethost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace
{
// Swallow the trace messages so we don't output to stderr of a process that we do not own unless tracing is enabled.
void swallow_trace(const pal::char_t* msg)
void __cdecl swallow_trace(const pal::char_t* msg)
{
(void)msg;
}
Expand Down
2 changes: 1 addition & 1 deletion src/installer/corehost/cli/redirected_error_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void reset_redirected_error_writer()
get_redirected_error_stream().swap(newstream);
}

void redirected_error_writer(const pal::char_t* msg)
void __cdecl redirected_error_writer(const pal::char_t* msg)
{
get_redirected_error_stream() << msg;
}
Expand Down
4 changes: 2 additions & 2 deletions src/installer/corehost/cli/redirected_error_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

void reset_redirected_error_writer();

void redirected_error_writer(const pal::char_t* msg);
void __cdecl redirected_error_writer(const pal::char_t* msg);

pal::string_t get_redirected_error_string();

#endif /* _COREHOST_CLI_REDIRECTED_ERROR_WRITER_H_ */
#endif /* _COREHOST_CLI_REDIRECTED_ERROR_WRITER_H_ */

0 comments on commit 2264fa0

Please sign in to comment.