Skip to content

Commit f248aad

Browse files
author
Del Myers
authored
Get Nagler building on Linux (#523)
* Get Nagler building on Linux Includes all changes needed to make sure that Nagler builds on Linux. Note: Nagler is not exercised on Linux yet, so there may be bugs. 1) Removes dependency on the PAL for Nagler 1) Copies/modifies a number of headers from the dotnet PAL 2) Reimplements a couple of standard Windows crt apis 3) Adds platform independent environment variable reading 4) Remove unneeded reference to atl in InitOnce 5) Replace ATL asserts with custom assert code. 2) Update Nagler to run on Linux 1) Fix string to use "tstring" and _T( instead of L" 2) Update XML loading to only multithread on Windows (since Windows uses COM for xml reading) 3) Disable "Inject Assembly" tests on Linux. 3) Add Nagler to the Linux CMake 1) Update CMake to allow libraries to declare when they link to the PAL 2) Add Nagler to the root cmake. 4) Fix some of the local build scripts * Fix getenv * Fix CMake add_exe * Remove redundancies. We have a dependency on Macros.h anyway, so make use of it in Nagler. * clean up dllmain * Code review comments. * Add namespace to reference to SystemString
1 parent e8c85fa commit f248aad

56 files changed

Lines changed: 6300 additions & 238 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/CMakeLists.txt

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ macro (build_init build_language build_type)
9494
include_directories(${REPOSITORY_ROOT}/src/unix/inc/empty)
9595
include_directories(${REPOSITORY_ROOT}/src/unix/inc/winsdk)
9696
include_directories(${REPOSITORY_ROOT}/src/InstrumentationEngine.Api)
97-
include_directories(${CORECLR_PAL_ROOT}/inc)
98-
include_directories(${CORECLR_PAL_ROOT}/inc/rt)
9997
include_directories(${GENERATED_INCLUDE_DIR})
10098
include_directories(${REPOSITORY_ROOT}/inc/clr/extra)
10199

@@ -167,14 +165,18 @@ endmacro (build_init)
167165

168166

169167
# projects that depend on the PAL.
170-
macro(add_lib lib_name type use_redefines hide_symbols)
168+
macro(add_lib lib_name type use_pal use_redefines hide_symbols)
171169
add_library(${lib_name}
172170
${type}
173171
${ARGN})
174172

175-
if (${use_redefines})
176-
add_dependencies(${lib_name} pal_redefines_header)
177-
endif (${use_redefines})
173+
if (${use_pal})
174+
target_include_directories(${lib_name} PUBLIC ${CORECLR_PAL_ROOT}/inc)
175+
target_include_directories(${lib_name} PUBLIC ${CORECLR_PAL_ROOT}/inc/rt)
176+
if (${use_redefines})
177+
add_dependencies(${lib_name} pal_redefines_header)
178+
endif (${use_redefines})
179+
endif (${use_pal})
178180

179181
if (${hide_symbols})
180182
set_property(TARGET ${lib_name} APPEND_STRING PROPERTY COMPILE_FLAGS "-fvisibility=hidden")
@@ -183,13 +185,17 @@ endmacro(add_lib lib_name type use_redefines hide_symbols sources)
183185

184186
# Adds an executable and optionally adds dependency on generated file pal_redefines.h for
185187
# projects that depend on the PAL.
186-
macro(add_exe exe_name use_redefines)
188+
macro(add_exe exe_name use_pal use_redefines)
187189
add_executable(${exe_name}
188190
${ARGN})
189191

190-
if (${use_redefines})
191-
add_dependencies(${exe_name} pal_redefines_header)
192-
endif (${use_redefines})
192+
if (${use_pal})
193+
target_include_directories(${exe_name} PUBLIC ${CORECLR_PAL_ROOT}/inc)
194+
target_include_directories(${exe_name} PUBLIC ${CORECLR_PAL_ROOT}/inc/rt)
195+
if (${use_redefines})
196+
add_dependencies(${exe_name} pal_redefines_header)
197+
endif (${use_redefines})
198+
endif (${use_pal})
193199
endmacro(add_exe exe_name use_redefines sources)
194200

195201
# Adds install target
@@ -365,6 +371,7 @@ add_subdirectory(Common.Lib)
365371
add_subdirectory(InstrumentationEngine.Api)
366372
add_subdirectory(InstrumentationEngine.Lib)
367373
add_subdirectory(InstrumentationEngine)
374+
add_subdirectory(Tests/InstrEngineTests/NaglerInstrumentationMethod)
368375

369376
enable_testing()
370377
add_subdirectory(Tests/CommonLibTests)

src/Common.Headers/Common.Headers.vcxitems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<ProjectCapability Include="SourceItemsFromImports" />
1717
</ItemGroup>
1818
<ItemGroup>
19+
<ClInclude Include="$(MSBuildThisFileDirectory)Macros.h" />
1920
<ClInclude Include="$(MSBuildThisFileDirectory)banned.h" />
2021
<ClInclude Include="$(MSBuildThisFileDirectory)CriticalSectionHolder.h" />
2122
<ClInclude Include="$(MSBuildThisFileDirectory)InitOnce.h" />

src/Common.Headers/InitOnce.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#pragma warning(disable: 6285) // bug in <functional> that compares 0 to 0, resulting in a warning.
99
#include <atomic>
1010
#include <functional>
11-
#include <atlsync.h>
1211
#pragma warning(pop)
1312

1413
#include <thread>

src/Common.Lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ set(src_files
2222

2323
add_lib(${PROJECT_NAME}
2424
STATIC
25+
false # use_pal
2526
false # use_redefines
2627
true # hide_symbols
2728
${src_files}

src/Common.Lib/stdafx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <msxml6.h>
3737
#endif
3838

39-
#include "Macros.h"
39+
#include "../Common.Headers/Macros.h"
4040
#include "refcount.h"
4141

4242
#include "../Common.Headers/banned.h"

src/InstrumentationEngine.Api/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ set(src_files ./InstrumentationEngine_api.cpp)
1414

1515
add_lib(InstrumentationEngine.Api
1616
STATIC
17+
true # use_pal
1718
false # use_redefines
1819
false # hide_symbols
1920
${src_files}

src/InstrumentationEngine.Lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ set(src_files
2626

2727
add_lib(${PROJECT_NAME}
2828
STATIC
29+
true # use_pal
2930
true # use_redefines
3031
false # hide_symbols
3132
${src_files}

src/InstrumentationEngine.Lib/stdafx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ using namespace ATL;
112112
#include "SharedArray.h"
113113

114114
#include "../Common.Headers/tstring.h"
115-
#include "../Common.Lib/Macros.h"
115+
#include "../Common.Headers/Macros.h"
116116
#include "../Common.Headers/CriticalSectionHolder.h"
117117
#include "../Common.Headers/InitOnce.h"
118118
#include "../Common.Headers/Singleton.h"

src/InstrumentationEngine.ProfilerProxy.Lib/EventLogger.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include "stdafx.h"
77
#include "../Common.Lib/EventLoggingBase.h"
8-
#include "../Common.Headers/InitOnce.h"
98

109
using namespace CommonLib;
1110

0 commit comments

Comments
 (0)