Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ project(CoreCLR)
# Enable @rpath support for shared libraries.
set(MACOSX_RPATH ON)

set(CLR_CMAKE_PLATFORM_LINUX_ALPINE 1)

if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
cmake_policy(SET CMP0042 NEW)
endif()
Expand Down Expand Up @@ -85,6 +87,13 @@ elseif(WIN32)
endif()
endif()

if(CLR_CMAKE_PLATFORM_LINUX_ALPINE)
set(CLR_CMAKE_ENABLE_TRACE 0)
add_compile_options(-fshort-wchar)
else()
set(CLR_CMAKE_ENABLE_TRACE 1)
endif()

if(WIN32)
enable_language(ASM_MASM)
else()
Expand Down Expand Up @@ -217,9 +226,9 @@ elseif (CLR_CMAKE_PLATFORM_UNIX)

endif(WIN32)

if (WIN32 OR CLR_CMAKE_PLATFORM_LINUX)
if ((WIN32 OR CLR_CMAKE_PLATFORM_LINUX) AND CLR_CMAKE_ENABLE_TRACE)
add_definitions(-DFEATURE_EVENT_TRACE=1)
endif (WIN32 OR CLR_CMAKE_PLATFORM_LINUX)
endif ((WIN32 OR CLR_CMAKE_PLATFORM_LINUX) AND CLR_CMAKE_ENABLE_TRACE)

if (CLR_CMAKE_PLATFORM_LINUX)
add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1)
Expand Down Expand Up @@ -705,4 +714,4 @@ else ()
endif ()
endif (IS_64BIT_BUILD EQUAL 1)

add_subdirectory(src)
#add_subdirectory(src)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? It doesn't look correct.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't intend to commit that, reducing my own build time while getting PAL working.

5 changes: 5 additions & 0 deletions src/ToolBox/SOS/lldbplugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
return()
endif()

if(CLR_CMAKE_PLATFORM_LINUX_ALPINE)
message(WARNING "lldb is not supported on Alpine Linux yet")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand conditions against few of few hundreds of Linux distributions...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure the best way forward, guess either just make it optional everywhere or have a nolldb parameter to build.sh . Just wanted to move forward. CLR_CMAKE_PLATFORM_LINUX_ALPINE should probably be a musl toggle.

return()
endif()

set(ENABLE_LLDBPLUGIN ${CLR_CMAKE_PLATFORM_UNIX} CACHE BOOL "Enable building the SOS plugin for LLDB.")
set(REQUIRE_LLDBPLUGIN ${CLR_CMAKE_PLATFORM_LINUX} CACHE BOOL "Require building the SOS plugin for LLDB.")

Expand Down
4 changes: 2 additions & 2 deletions src/dlls/mscoree/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ else()
)
endif(WIN32)

if(CLR_CMAKE_PLATFORM_LINUX)
if(CLR_CMAKE_PLATFORM_LINUX AND CLR_CMAKE_ENABLE_TRACE)
list(APPEND CORECLR_LIBRARIES
eventprovider
)

endif(CLR_CMAKE_PLATFORM_LINUX)
endif(CLR_CMAKE_PLATFORM_LINUX AND CLR_CMAKE_ENABLE_TRACE)

target_link_libraries(coreclr ${CORECLR_LIBRARIES})

Expand Down
2 changes: 2 additions & 0 deletions src/pal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 2.8.12.2)

project(COREPAL)

set(PAL_CMAKE_ENABLE_TRACE 0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you disabling it for everybody?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't have a good way to toggle this.


include_directories(${COREPAL_SOURCE_DIR}/inc)
include_directories(${COREPAL_SOURCE_DIR}/src)
include_directories(${COREPAL_SOURCE_DIR}/../inc)
Expand Down
5 changes: 3 additions & 2 deletions src/pal/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
unwind
unwind-generic
uuid
intl
)
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)

Expand Down Expand Up @@ -254,9 +255,9 @@ endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)

add_subdirectory(examples)

if(CMAKE_SYSTEM_NAME STREQUAL Linux)
if((CMAKE_SYSTEM_NAME STREQUAL Linux) AND PAL_CMAKE_ENABLE_TRACE)
add_subdirectory(eventprovider)
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
endif((CMAKE_SYSTEM_NAME STREQUAL Linux) AND PAL_CMAKE_ENABLE_TRACE)

# Install the static PAL library for VS
install (TARGETS coreclrpal DESTINATION lib)
2 changes: 1 addition & 1 deletion src/pal/src/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ else() # Anything else is Linux
unset(HAVE_LIBUNWIND_H CACHE)
message(FATAL_ERROR "Cannot find libunwind. Try installing libunwind8 and libunwind8-dev (or the appropriate packages for your platform)")
endif()
if(NOT HAVE_LTTNG_TRACEPOINT_H)
if(NOT HAVE_LTTNG_TRACEPOINT_H AND PAL_CMAKE_ENABLE_TRACE)
unset(HAVE_LTTNG_TRACEPOINT_H CACHE)
message(FATAL_ERROR "Cannot find liblttng-ust-dev. Try installing liblttng-ust-dev (or the appropriate packages for your platform)")
endif()
Expand Down
4 changes: 3 additions & 1 deletion src/pal/src/loader/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ Module Name:
#include <sys/types.h>
#include <sys/mman.h>

#if defined(__LINUX__)
#if defined(__LINUX__) && defined(__GLIBC__)
#include <gnu/lib-names.h>
#else
#define LIBC_SO "libc.so"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really want to define it for NetBSD?

shortAsciiName = "libc.so";

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a quick change to get it working, not sure of the correct path forward.

#endif

using namespace CorUnix;
Expand Down
2 changes: 1 addition & 1 deletion src/pal/src/misc/sysinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ PAL_GetLogicalProcessorCacheSizeFromOS()
{
size_t cacheSize = 0;

#if HAVE_SYSCONF && defined(__LINUX__)
#if HAVE_SYSCONF && defined(__LINUX__) && defined(_SC_LEVEL1_DCACHE_SIZE_)
cacheSize = max(cacheSize, sysconf(_SC_LEVEL1_DCACHE_SIZE));
cacheSize = max(cacheSize, sysconf(_SC_LEVEL1_ICACHE_SIZE));
cacheSize = max(cacheSize, sysconf(_SC_LEVEL2_CACHE_SIZE));
Expand Down
5 changes: 5 additions & 0 deletions src/pal/src/safecrt/internal_securecrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#ifndef _INC_INTERNAL_SECURECRT
#define _INC_INTERNAL_SECURECRT

typedef unsigned long __uint64_t;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is asking for breakage.

$ grep -r __int64_t /usr/include/                                                                                                                     
/usr/include/machine/ansi.h:#define _BSD_TIME_T_        __int64_t   /* time() */
/usr/include/machine/int_types.h:typedef    long int        __int64_t;
/usr/include/sys/ansi.h:typedef __int64_t   __off_t;    /* file offset */
/usr/include/sys/ansi.h:    __int64_t __mbstateL; /* for alignment */
/usr/include/sys/socket.h:#define _SS_ALIGNSIZE (sizeof(__int64_t))
/usr/include/sys/socket.h:  __int64_t     __ss_align;/* force desired structure storage alignment */
/usr/include/sys/stdint.h:typedef   __int64_t   int64_t;
/usr/include/sys/stdint.h:#define   int64_t     __int64_t
/usr/include/sys/types.h:typedef    __int64_t   int64_t;
/usr/include/sys/types.h:#define    int64_t     __int64_t
/usr/include/sys/common_ansi.h:#define  _BSD_TIME_T_        __int64_t   /* time() */
/usr/include/sys/common_int_types.h:typedef __INT64_TYPE__        __int64_t;
/usr/include/stdint.h:typedef   __int64_t   int64_t;
/usr/include/stdint.h:#define   int64_t     __int64_t
/usr/include/amd64/ansi.h:#define   _BSD_TIME_T_        __int64_t   /* time() */
/usr/include/amd64/int_types.h:typedef  long int        __int64_t;
/usr/include/i386/ansi.h:#define    _BSD_TIME_T_        __int64_t   /* time() */
/usr/include/i386/int_types.h:typedef   __COMPILER_INT64__  __int64_t;
/usr/include/i386/int_types.h:typedef   long long int       __int64_t;

typedef signed long __int64_t;
typedef __int64_t int64_t;
typedef __uint64_t uint64_t;

/* more VS specific goodness */
#define __out_ecount_z( x )
#define __out_ecount( x )
Expand Down
1 change: 1 addition & 0 deletions src/pal/src/safecrt/output.inl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
//typedef __int64_t __int64;


#define __GNUC_VA_LIST
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you define it via CMake? It looks wrong here.

#define FORMAT_VALIDATIONS

typedef double _CRT_DOUBLE;
Expand Down
1 change: 1 addition & 0 deletions src/pal/src/safecrt/safecrt_output_l.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
****/

#define _SAFECRT_IMPL
#define __GNUC_VA_LIST
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you define it via CMake? It looks wrong here.


#define __STDC_LIMIT_MACROS
#include "pal/palinternal.h"
Expand Down
4 changes: 2 additions & 2 deletions src/pal/src/thread/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void CONTEXTToNativeContext(CONST CONTEXT *lpContext, native_context_t *native)

if ((lpContext->ContextFlags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT)
{
#ifdef _AMD64_
#if 0 //_AMD64_
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why for everybody?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a suitable CMake test.

FPREG_ControlWord(native) = lpContext->FltSave.ControlWord;
FPREG_StatusWord(native) = lpContext->FltSave.StatusWord;
FPREG_TagWord(native) = lpContext->FltSave.TagWord;
Expand Down Expand Up @@ -481,7 +481,7 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex

if ((contextFlags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT)
{
#ifdef _AMD64_
#if 0//def _AMD64_
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why for everybody?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is generally a quick hack to run on Alpine, as I said. I don't
know a good way to detect musl or Alpine to do this.

On Fri, 12 Feb 2016, 11:24 Kamil Rytarowski notifications@github.com
wrote:

In src/pal/src/thread/context.cpp
#2262 (comment):

@@ -481,7 +481,7 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex

 if ((contextFlags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT)
 {

-#ifdef AMD64
+#if 0//def AMD64

why for everybody?


Reply to this email directly or view it on GitHub
https://github.com/dotnet/coreclr/pull/2262/files#r52730507.

lpContext->FltSave.ControlWord = FPREG_ControlWord(native);
lpContext->FltSave.StatusWord = FPREG_StatusWord(native);
lpContext->FltSave.TagWord = FPREG_TagWord(native);
Expand Down
4 changes: 3 additions & 1 deletion src/pal/tests/palsuite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ add_subdirectory(miscellaneous)
add_subdirectory(pal_specific)
add_subdirectory(samples)
add_subdirectory(threading)
add_subdirectory(eventprovider)
if(PAL_CMAKE_ENABLE_TRACE)
add_subdirectory(eventprovider)
endif()

4 changes: 2 additions & 2 deletions src/vm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ set(VM_SOURCES_WKS
weakreferencenative.cpp
)

if(CLR_CMAKE_PLATFORM_LINUX OR WIN32)
if((CLR_CMAKE_PLATFORM_LINUX OR WIN32) AND CLR_CMAKE_ENABLE_TRACE)
list(APPEND VM_SOURCES_WKS
eventtrace.cpp
)
endif(CLR_CMAKE_PLATFORM_LINUX OR WIN32)
endif((CLR_CMAKE_PLATFORM_LINUX OR WIN32) AND CLR_CMAKE_ENABLE_TRACE)

if(WIN32)

Expand Down