GCC compatibility fixes dotnet/coreclr#7 (dotnet/coreclr#22810)
authorSinan Kaya <41809318+franksinankaya@users.noreply.github.com>
Tue, 26 Feb 2019 10:55:05 +0000 (05:55 -0500)
committerJan Vorlicek <janvorli@microsoft.com>
Tue, 26 Feb 2019 10:55:05 +0000 (11:55 +0100)
* Use thread_local for thread local storage on non MSVC targets

* Use local copy of visitor rather than function parameter

* Remove extra class qualifier

* Replace hex number representation in ASM files

* Reorder STDAPI and DLLEXPORT

* Suppress conversion

Suppress warning during hash

add casting

* Remove anonymous struct

src/vm/codeversion.h:112:16: warning: ‘struct NativeCodeVersion::<anonymous union>::SyntheticStorage’ invalid; an anonymous union can only have non-static data members [-fpermissive]
         struct SyntheticStorage

* Remove class declaration

Remove extra class declaration

* Remove extern C

* Add implicit paranthesis

src/vm/amd64/virtualcallstubcpu.hpp:735:103: warning: suggest parentheses around ‘-’ in operand of ‘&’ [-Wparentheses]
     resolveInit.toMiss1                = offsetof(ResolveStub,miss)-(offsetof(ResolveStub,toMiss1)+1) & 0xFF;
                                                                                                       ^
src/vm/amd64/virtualcallstubcpu.hpp:741:103: warning: suggest parentheses around ‘-’ in operand of ‘&’ [-Wparentheses]
     resolveInit.toMiss2                = offsetof(ResolveStub,miss)-(offsetof(ResolveStub,toMiss2)+1) & 0xFF;

Add parenthesis

src/vm/dataimage.cpp:631:55: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
                  previousRvaInfo->rva == rvaInfo->rva && previousRvaInfo->size >= rvaInfo->size

Add parenthesis

src/debug/daccess/daccess.cpp:6871:29: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
     _ASSERTE(peFile == NULL && reflectionModule != NULL || peFile != NULL && reflectionModule == NULL);

Add parenthesis

src/vm/dataimage.cpp:631:57: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
                  (previousRvaInfo->rva == rvaInfo->rva) && (previousRvaInfo->size >= rvaInfo->size)

* Initialize member 1

src/ilasm/method.cpp:35:36: warning: operation on ‘((Method*)this)->Method::m_ulColumns[0]’ may be undefined [-Wsequence-point]
     m_ulColumns[0]=m_ulColumns[0]=0;

* Remove unknown compiler option

* Abstract DLLEXPORT

Commit migrated from https://github.com/dotnet/coreclr/commit/cbd672eb2735d583ee6fa46aaf599241fdf6face

26 files changed:
src/coreclr/src/debug/daccess/daccess.cpp
src/coreclr/src/debug/daccess/dacdbiimpl.cpp
src/coreclr/src/debug/daccess/dacdbiimpl.h
src/coreclr/src/debug/di/shimpriv.h
src/coreclr/src/dlls/mscoree/unixinterface.cpp
src/coreclr/src/ilasm/CMakeLists.txt
src/coreclr/src/ilasm/method.cpp
src/coreclr/src/pal/inc/unixasmmacros.inc
src/coreclr/src/vm/amd64/jithelpers_fast.S
src/coreclr/src/vm/amd64/jithelpers_fastwritebarriers.S
src/coreclr/src/vm/amd64/jithelpers_slow.S
src/coreclr/src/vm/amd64/virtualcallstubamd64.S
src/coreclr/src/vm/amd64/virtualcallstubcpu.hpp
src/coreclr/src/vm/codeman.cpp
src/coreclr/src/vm/codeversion.h
src/coreclr/src/vm/crossloaderallocatorhash.inl
src/coreclr/src/vm/dataimage.cpp
src/coreclr/src/vm/eventpipebuffermanager.cpp
src/coreclr/src/vm/eventpipebuffermanager.h
src/coreclr/src/vm/inlinetracking.h
src/coreclr/src/vm/method.hpp
src/coreclr/src/vm/rejit.h
src/coreclr/src/zap/zapimport.cpp
src/coreclr/src/zap/zapinfo.cpp
src/coreclr/src/zap/zapmetadata.h
src/coreclr/tests/src/Interop/IJW/FakeMscoree/mscoree.cpp

index 5ebbe31..a5e1387 100644 (file)
@@ -6868,7 +6868,7 @@ ClrDataAccess::GetMDImport(const PEFile* peFile, const ReflectionModule* reflect
     PVOID       mdBaseHost = NULL;
     bool        isAlternate = false;
 
-    _ASSERTE(peFile == NULL && reflectionModule != NULL || peFile != NULL && reflectionModule == NULL);
+    _ASSERTE((peFile == NULL && reflectionModule != NULL) || (peFile != NULL && reflectionModule == NULL));
     TADDR       peFileAddr = (peFile != NULL) ? dac_cast<TADDR>(peFile) : dac_cast<TADDR>(reflectionModule);
 
     //
@@ -7507,8 +7507,8 @@ STDAPI CLRDataAccessCreateInstance(ICLRDataTarget * pLegacyTarget,
 // This is the legacy entrypoint to DAC, used by dbgeng/dbghelp (windbg, SOS, watson, etc).
 //
 //----------------------------------------------------------------------------
-DLLEXPORT 
 STDAPI
+DLLEXPORT
 CLRDataCreateInstance(REFIID iid,
                       ICLRDataTarget * pLegacyTarget,
                       void ** iface)
index 828f639..a008dc1 100644 (file)
@@ -184,8 +184,8 @@ template<class T> void DeleteDbiMemory(T *p)
 //    Must call Destroy to on interface to free its resources.
 //
 //---------------------------------------------------------------------------------------
-DLLEXPORT 
 STDAPI
+DLLEXPORT
 DacDbiInterfaceInstance(
     ICorDebugDataTarget * pTarget,
     CORDB_ADDRESS baseAddress,
index e27fe0b..ae88efe 100644 (file)
 
 // Prototype for creation functions
 
-DLLEXPORT 
 STDAPI
+DLLEXPORT
 CLRDataCreateInstance(REFIID iid,
     ICLRDataTarget * pLegacyTarget,
     void ** iface);
 
-DLLEXPORT 
 STDAPI
+DLLEXPORT
 DacDbiInterfaceInstance(
     ICorDebugDataTarget * pTarget,
     CORDB_ADDRESS baseAddress,
index 279feb9..0f67cd7 100644 (file)
@@ -216,13 +216,13 @@ public:
     ///
 
     // Implementation of ICorDebugManagedCallback4::BeforeGarbageCollection
-    COM_METHOD ShimProxyCallback::BeforeGarbageCollection(ICorDebugProcess* pProcess);
+    COM_METHOD BeforeGarbageCollection(ICorDebugProcess* pProcess);
 
     // Implementation of ICorDebugManagedCallback4::AfterGarbageCollection
-    COM_METHOD ShimProxyCallback::AfterGarbageCollection(ICorDebugProcess* pProcess);
+    COM_METHOD AfterGarbageCollection(ICorDebugProcess* pProcess);
 
     // Implementation of ICorDebugManagedCallback4::DataBreakpoint
-    COM_METHOD ShimProxyCallback::DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugThread* pThread, BYTE* pContext, ULONG32 contextSize);
+    COM_METHOD DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugThread* pThread, BYTE* pContext, ULONG32 contextSize);
 };
 
 
index 0769ea4..0f52afa 100644 (file)
@@ -137,7 +137,7 @@ static void ConvertConfigPropertiesToUnicode(
 
 #if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
 // Reference to the global holding the path to the JIT
-extern "C" LPCWSTR g_CLRJITPath;
+extern LPCWSTR g_CLRJITPath;
 #endif // !defined(FEATURE_MERGE_JIT_AND_ENGINE)
 
 #ifdef FEATURE_GDBJIT
index f6852e6..3bb13ad 100644 (file)
@@ -52,7 +52,7 @@ if(CLR_CMAKE_PLATFORM_UNIX)
   # Clang also produces a bad-codegen on this prebuilt file with optimization.
   # https://github.com/dotnet/coreclr/issues/2305
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-non-virtual-dtor")
-  add_compile_options(-Wno-deprecated-register)
+  add_compile_options(-Wno-register)
   add_compile_options(-Wno-array-bounds)
   add_compile_options(-Wno-unused-label)
   set_source_files_properties( prebuilt/asmparse.cpp PROPERTIES COMPILE_FLAGS "-O0" )
index 8fc300c..298fc15 100644 (file)
@@ -32,7 +32,7 @@ Method::Method(Assembler *pAssembler, Class *pClass, __in __nullterminated char
     m_szExportAlias = NULL;
     m_dwExportOrdinal = 0xFFFFFFFF;
     m_ulLines[0]=m_ulLines[1]=0;
-    m_ulColumns[0]=m_ulColumns[0]=0;
+    m_ulColumns[0]=m_ulColumns[1]=0;
     m_pbsBody = NULL;
     m_fNewBody = TRUE;
     m_fNew = TRUE;
index a1f1a69..f553840 100644 (file)
@@ -2,7 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-#define INVALIDGCVALUE 0CCCCCCCDh
+#define INVALIDGCVALUE 0xCCCCCCCD
 
 #if defined(__APPLE__)
 #define C_FUNC(name) _##name
index 6f955b0..9503333 100644 (file)
@@ -81,14 +81,14 @@ LEAF_ENTRY JIT_WriteBarrier, _TEXT
         // Update the write watch table if necessary
         mov     rax, rdi
         movabs  r10, 0xF0F0F0F0F0F0F0F0
-        shr     rax, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift
+        shr     rax, 0xC // SoftwareWriteWatch::AddressToTableByteIndexShift
         NOP_2_BYTE // padding for alignment of constant
         movabs  r11, 0xF0F0F0F0F0F0F0F0
         add     rax, r10
-        cmp     byte ptr [rax], 0h
+        cmp     byte ptr [rax], 0x0
         .byte 0x75, 0x06
         // jne     CheckCardTable
-        mov     byte ptr [rax], 0FFh
+        mov     byte ptr [rax], 0xFF
 
         NOP_3_BYTE // padding for alignment of constant
 
@@ -112,27 +112,27 @@ LEAF_ENTRY JIT_WriteBarrier, _TEXT
 
         // Touch the card table entry, if not already dirty.
         shr     rdi, 0x0B
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
         .byte 0x75, 0x02
         // jne     UpdateCardTable
         REPRET
 
     UpdateCardTable:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 
 #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
         NOP_2_BYTE // padding for alignment of constant
         shr     rdi, 0x0A
 
         movabs  rax, 0xF0F0F0F0F0F0F0F0
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
 
         .byte 0x75, 0x02
         // jne     UpdateCardBundle_WriteWatch_PostGrow64
         REPRET
 
     UpdateCardBundle_WriteWatch_PostGrow64:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 #endif
 
         ret
@@ -312,15 +312,15 @@ LEAF_ENTRY JIT_ByRefWriteBarrier, _TEXT
 #ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
         // Update the write watch table if necessary
         PREPARE_EXTERNAL_VAR g_sw_ww_enabled_for_gc_heap, rax
-        cmp     byte ptr [rax], 0h
+        cmp     byte ptr [rax], 0x0
         je      CheckCardTable_ByRefWriteBarrier
         mov     rax, rdi
-        shr     rax, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift
+        shr     rax, 0xC // SoftwareWriteWatch::AddressToTableByteIndexShift
         PREPARE_EXTERNAL_VAR g_sw_ww_table, r10
         add     rax, qword ptr [r10]
-        cmp     byte ptr [rax], 0h
+        cmp     byte ptr [rax], 0x0
         jne     CheckCardTable_ByRefWriteBarrier
-        mov     byte ptr [rax], 0FFh
+        mov     byte ptr [rax], 0xFF
 #endif
 
     CheckCardTable_ByRefWriteBarrier:
@@ -334,8 +334,8 @@ LEAF_ENTRY JIT_ByRefWriteBarrier, _TEXT
 
         // move current rdi value into rcx and then increment the pointers
         mov     rcx, rdi
-        add     rsi, 8h
-        add     rdi, 8h
+        add     rsi, 0x8
+        add     rdi, 0x8
 
         // Check if we need to update the card table
         // Calc pCardByte
@@ -345,13 +345,13 @@ LEAF_ENTRY JIT_ByRefWriteBarrier, _TEXT
         mov     rax, [rax]
 
         // Check if this card is dirty
-        cmp     byte ptr [rcx + rax], 0FFh
+        cmp     byte ptr [rcx + rax], 0xFF
 
         jne     UpdateCardTable_ByRefWriteBarrier
         REPRET
 
     UpdateCardTable_ByRefWriteBarrier:
-        mov     byte ptr [rcx + rax], 0FFh
+        mov     byte ptr [rcx + rax], 0xFF
 
 #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
         // Shift rcx by 0x0A more to get the card bundle byte (we shifted by 0x0B already)
@@ -361,13 +361,13 @@ LEAF_ENTRY JIT_ByRefWriteBarrier, _TEXT
         add     rcx, [rax]
 
         // Check if this bundle byte is dirty
-        cmp     byte ptr [rcx], 0FFh
+        cmp     byte ptr [rcx], 0xFF
 
         jne     UpdateCardBundle_ByRefWriteBarrier
         REPRET
 
     UpdateCardBundle_ByRefWriteBarrier:
-        mov     byte ptr [rcx], 0FFh
+        mov     byte ptr [rcx], 0xFF
 #endif
 
         ret
@@ -383,8 +383,8 @@ LEAF_ENTRY JIT_ByRefWriteBarrier, _TEXT
 #endif
     Exit_ByRefWriteBarrier:
         // Increment the pointers before leaving
-        add     rdi, 8h
-        add     rsi, 8h
+        add     rdi, 0x8
+        add     rsi, 0x8
         ret
 LEAF_END_MARKED JIT_ByRefWriteBarrier, _TEXT
 
index 23c1115..35bfbef 100644 (file)
@@ -38,13 +38,13 @@ PATCH_LABEL JIT_WriteBarrier_PreGrow64_Patch_Label_CardTable
 
         // Touch the card table entry, if not already dirty.
         shr     rdi, 0x0B
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
         .byte 0x75, 0x02
         // jne     UpdateCardTable_PreGrow64
         REPRET
 
     UpdateCardTable_PreGrow64:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 
 #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
         NOP_6_BYTE // padding for alignment of constant
@@ -55,14 +55,14 @@ PATCH_LABEL JIT_WriteBarrier_PreGrow64_Patch_Label_CardBundleTable
         // Touch the card bundle, if not already dirty.
         // rdi is already shifted by 0xB, so shift by 0xA more
         shr     rdi, 0x0A
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
 
         .byte 0x75, 0x02 
         // jne     UpdateCardBundle_PreGrow64
         REPRET
 
     UpdateCardBundle_PreGrow64:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 #endif
 
         ret
@@ -123,13 +123,13 @@ PATCH_LABEL JIT_WriteBarrier_PostGrow64_Patch_Label_CardTable
 
         // Touch the card table entry, if not already dirty.
         shr     rdi, 0x0B
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
         .byte 0x75, 0x02
         // jne     UpdateCardTable_PostGrow64
         REPRET
 
     UpdateCardTable_PostGrow64:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 
 #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
         NOP_6_BYTE // padding for alignment of constant
@@ -140,14 +140,14 @@ PATCH_LABEL JIT_WriteBarrier_PostGrow64_Patch_Label_CardBundleTable
         // Touch the card bundle, if not already dirty.
         // rdi is already shifted by 0xB, so shift by 0xA more
         shr     rdi, 0x0A
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
 
         .byte 0x75, 0x02 
         // jne     UpdateCardBundle_PostGrow64
         REPRET
 
     UpdateCardBundle_PostGrow64:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 #endif
 
         ret
@@ -182,13 +182,13 @@ PATCH_LABEL JIT_WriteBarrier_SVR64_PatchLabel_CardTable
 
         shr     rdi, 0x0B
 
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
         .byte 0x75, 0x02
         // jne     UpdateCardTable_SVR64
         REPRET
 
     UpdateCardTable_SVR64:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 
 #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
         NOP_6_BYTE // padding for alignment of constant
@@ -198,14 +198,14 @@ PATCH_LABEL JIT_WriteBarrier_SVR64_PatchLabel_CardBundleTable
 
         // Shift the address by 0xA more since already shifted by 0xB
         shr     rdi, 0x0A
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
 
         .byte 0x75, 0x02 
         // jne     UpdateCardBundle_SVR64
         REPRET
 
     UpdateCardBundle_SVR64:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 #endif
 
         ret
@@ -236,15 +236,15 @@ LEAF_ENTRY JIT_WriteBarrier_WriteWatch_PreGrow64, _TEXT
         mov     rax, rdi
 PATCH_LABEL JIT_WriteBarrier_WriteWatch_PreGrow64_Patch_Label_WriteWatchTable
         movabs  r10, 0xF0F0F0F0F0F0F0F0
-        shr     rax, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift
+        shr     rax, 0x0C // SoftwareWriteWatch::AddressToTableByteIndexShift
         NOP_2_BYTE // padding for alignment of constant
 PATCH_LABEL JIT_WriteBarrier_WriteWatch_PreGrow64_Patch_Label_Lower
         movabs  r11, 0xF0F0F0F0F0F0F0F0
         add     rax, r10
-        cmp     byte ptr [rax], 0h
+        cmp     byte ptr [rax], 0x0
         .byte 0x75, 0x03
         // jne     CheckCardTable_WriteWatch_PreGrow64
-        mov     byte ptr [rax], 0FFh
+        mov     byte ptr [rax], 0xFF
 
     CheckCardTable_WriteWatch_PreGrow64:
         // Check the lower ephemeral region bound.
@@ -263,13 +263,13 @@ PATCH_LABEL JIT_WriteBarrier_WriteWatch_PreGrow64_Patch_Label_Lower
         NOP_2_BYTE // padding for alignment of constant
 PATCH_LABEL JIT_WriteBarrier_WriteWatch_PreGrow64_Patch_Label_CardTable
         movabs  rax, 0xF0F0F0F0F0F0F0F0
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
         .byte 0x75, 0x02
         // jne     UpdateCardTable_WriteWatch_PreGrow64
         REPRET
 
     UpdateCardTable_WriteWatch_PreGrow64:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 
 #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
         NOP_2_BYTE // padding for alignment of constant
@@ -277,14 +277,14 @@ PATCH_LABEL JIT_WriteBarrier_WriteWatch_PreGrow64_Patch_Label_CardBundleTable
         movabs  rax, 0xF0F0F0F0F0F0F0F0
 
         shr     rdi, 0x0A
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
 
         .byte 0x75, 0x02
         // jne     UpdateCardBundle_WriteWatch_PreGrow64
         REPRET
 
     UpdateCardBundle_WriteWatch_PreGrow64:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 #endif
 
         ret
@@ -314,15 +314,15 @@ LEAF_ENTRY JIT_WriteBarrier_WriteWatch_PostGrow64, _TEXT
         mov     rax, rdi
 PATCH_LABEL JIT_WriteBarrier_WriteWatch_PostGrow64_Patch_Label_WriteWatchTable
         movabs  r10, 0xF0F0F0F0F0F0F0F0
-        shr     rax, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift
+        shr     rax, 0x0C // SoftwareWriteWatch::AddressToTableByteIndexShift
         NOP_2_BYTE // padding for alignment of constant
 PATCH_LABEL JIT_WriteBarrier_WriteWatch_PostGrow64_Patch_Label_Lower
         movabs  r11, 0xF0F0F0F0F0F0F0F0
         add     rax, r10
-        cmp     byte ptr [rax], 0h
+        cmp     byte ptr [rax], 0x0
         .byte 0x75, 0x06
         // jne     CheckCardTable_WriteWatch_PostGrow64
-        mov     byte ptr [rax], 0FFh
+        mov     byte ptr [rax], 0xFF
 
         NOP_3_BYTE // padding for alignment of constant
 
@@ -358,13 +358,13 @@ PATCH_LABEL JIT_WriteBarrier_WriteWatch_PostGrow64_Patch_Label_CardTable
 
         // Touch the card table entry, if not already dirty.
         shr     rdi, 0x0B
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
         .byte 0x75, 0x02
         // jne     UpdateCardTable_WriteWatch_PostGrow64
         REPRET
 
     UpdateCardTable_WriteWatch_PostGrow64:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 
 #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
         NOP_2_BYTE // padding for alignment of constant
@@ -372,14 +372,14 @@ PATCH_LABEL JIT_WriteBarrier_WriteWatch_PostGrow64_Patch_Label_CardTable
 
 PATCH_LABEL JIT_WriteBarrier_WriteWatch_PostGrow64_Patch_Label_CardBundleTable
         movabs  rax, 0xF0F0F0F0F0F0F0F0
-        cmp     byte ptr [rdi + rax], 0FFh
+        cmp     byte ptr [rdi + rax], 0xFF
 
         .byte 0x75, 0x02
         // jne     UpdateCardBundle_WriteWatch_PostGrow64
         REPRET
 
     UpdateCardBundle_WriteWatch_PostGrow64:
-        mov     byte ptr [rdi + rax], 0FFh
+        mov     byte ptr [rdi + rax], 0xFF
 #endif
 
         ret
@@ -417,25 +417,25 @@ LEAF_ENTRY JIT_WriteBarrier_WriteWatch_SVR64, _TEXT
         mov     rax, rdi
 PATCH_LABEL JIT_WriteBarrier_WriteWatch_SVR64_PatchLabel_WriteWatchTable
         movabs  r10, 0xF0F0F0F0F0F0F0F0
-        shr     rax, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift
+        shr     rax, 0xC // SoftwareWriteWatch::AddressToTableByteIndexShift
         NOP_2_BYTE // padding for alignment of constant
 PATCH_LABEL JIT_WriteBarrier_WriteWatch_SVR64_PatchLabel_CardTable
         movabs  r11, 0xF0F0F0F0F0F0F0F0
         add     rax, r10
-        cmp     byte ptr [rax], 0h
+        cmp     byte ptr [rax], 0x0
         .byte 0x75, 0x03
         // jne     CheckCardTable_WriteWatch_SVR64
-        mov     byte ptr [rax], 0FFh
+        mov     byte ptr [rax], 0xFF
 
     CheckCardTable_WriteWatch_SVR64:
         shr     rdi, 0x0B
-        cmp     byte ptr [rdi + r11], 0FFh
+        cmp     byte ptr [rdi + r11], 0xFF
         .byte 0x75, 0x02
         // jne     UpdateCardTable_WriteWatch_SVR64
         REPRET
 
     UpdateCardTable_WriteWatch_SVR64:
-        mov     byte ptr [rdi + r11], 0FFh
+        mov     byte ptr [rdi + r11], 0xFF
 
 #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
         NOP // padding for alignment of constant
@@ -444,13 +444,13 @@ PATCH_LABEL JIT_WriteBarrier_WriteWatch_SVR64_PatchLabel_CardBundleTable
         movabs  r11, 0xF0F0F0F0F0F0F0F0
 
         shr     rdi, 0x0A
-        cmp     byte ptr [rdi + r11], 0FFh
+        cmp     byte ptr [rdi + r11], 0xFF
         .byte 0x75, 0x02
         // jne     UpdateCardBundle_WriteWatch_SVR64
         REPRET
 
     UpdateCardBundle_WriteWatch_SVR64:
-        mov     byte ptr [rdi + r11], 0FFh
+        mov     byte ptr [rdi + r11], 0xFF
 #endif
 
         ret
index f61b42a..aa2e8cc 100644 (file)
@@ -71,15 +71,15 @@ LEAF_ENTRY JIT_WriteBarrier_Debug, _TEXT
 #ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
         // Update the write watch table if necessary
         PREPARE_EXTERNAL_VAR g_sw_ww_enabled_for_gc_heap, r10
-        cmp     byte ptr [r10], 0h
+        cmp     byte ptr [r10], 0x0
         je      CheckCardTable_Debug
         mov     r10, rdi
-        shr     r10, 0Ch // SoftwareWriteWatch::AddressToTableByteIndexShift
+        shr     r10, 0xC // SoftwareWriteWatch::AddressToTableByteIndexShift
         PREPARE_EXTERNAL_VAR g_sw_ww_table, r11
         add     r10, qword ptr [r11]
-        cmp     byte ptr [r10], 0h
+        cmp     byte ptr [r10], 0x0
         jne     CheckCardTable_Debug
-        mov     byte ptr [r10], 0FFh
+        mov     byte ptr [r10], 0xFF
 #endif
 
     CheckCardTable_Debug:
@@ -99,13 +99,13 @@ LEAF_ENTRY JIT_WriteBarrier_Debug, _TEXT
         mov     r10, [r10]
 
         // Check if this card is dirty
-        cmp     byte ptr [rdi + r10], 0FFh
+        cmp     byte ptr [rdi + r10], 0xFF
 
         jne     UpdateCardTable_Debug
         REPRET
 
     UpdateCardTable_Debug:
-        mov     byte ptr [rdi + r10], 0FFh
+        mov     byte ptr [rdi + r10], 0xFF
 
 #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
         // Shift rdi by 0x0A more to get the card bundle byte (we shifted by 0x0B already)
@@ -115,13 +115,13 @@ LEAF_ENTRY JIT_WriteBarrier_Debug, _TEXT
         add     rdi, [r10]
 
         // Check if this bundle byte is dirty
-        cmp     byte ptr [rdi], 0FFh
+        cmp     byte ptr [rdi], 0xFF
 
         jne     UpdateCardBundle_Debug
         REPRET
 
     UpdateCardBundle_Debug:
-        mov     byte ptr [rdi], 0FFh
+        mov     byte ptr [rdi], 0xFF
 #endif
 
         ret
index 59b5b77..744aaa1 100644 (file)
@@ -59,19 +59,19 @@ LEAF_ENTRY ResolveWorkerChainLookupAsmStub, _TEXT
         jnz     Fail_RWCLAS          // If the BACKPATCH_FLAGS is set we will go directly to the ResolveWorkerAsmStub
         
 MainLoop_RWCLAS:
-        mov     rax, [rax+18h]   // get the next entry in the chain (don't bother checking the first entry again)
+        mov     rax, [rax+0x18]   // get the next entry in the chain (don't bother checking the first entry again)
         test    rax,rax          // test if we hit a terminating NULL
         jz      Fail_RWCLAS
 
-        cmp    rdx, [rax+00h]    // compare our MT with the one in the ResolveCacheElem
+        cmp    rdx, [rax+0x00]    // compare our MT with the one in the ResolveCacheElem
         jne    MainLoop_RWCLAS
-        cmp    r10, [rax+08h]    // compare our DispatchToken with one in the ResolveCacheElem
+        cmp    r10, [rax+0x08]    // compare our DispatchToken with one in the ResolveCacheElem
         jne    MainLoop_RWCLAS
 Success_RWCLAS:        
         PREPARE_EXTERNAL_VAR CHAIN_SUCCESS_COUNTER, rdx
         sub    qword ptr [rdx],1 // decrement success counter 
         jl     Promote_RWCLAS
-        mov    rax, [rax+10h]    // get the ImplTarget
+        mov    rax, [rax+0x10]    // get the ImplTarget
         pop    rdx
         jmp    rax
         
index 3c3593f..0d6ca81 100644 (file)
@@ -509,7 +509,7 @@ struct VTableCallHolder
         return 3 + (offsetOfIndirection >= 0x80 ? 7 : 4) + (offsetAfterIndirection >= 0x80 ? 6 : 3) + 4;
     }
 
-    static VTableCallHolder* VTableCallHolder::FromVTableCallEntry(PCODE entry) { LIMITED_METHOD_CONTRACT; return (VTableCallHolder*)entry; }
+    static VTableCallHolder* FromVTableCallEntry(PCODE entry) { LIMITED_METHOD_CONTRACT; return (VTableCallHolder*)entry; }
 
 private:
     // VTableCallStub follows here. It is dynamically sized on allocation because it could 
@@ -732,13 +732,13 @@ void ResolveHolder::InitializeStatic()
     resolveInit.part4 [2]              = 0x50;
     resolveInit.mtOffset               = offsetof(ResolveCacheElem,pMT) & 0xFF;
     resolveInit.part5 [0]              = 0x75;
-    resolveInit.toMiss1                = offsetof(ResolveStub,miss)-(offsetof(ResolveStub,toMiss1)+1) & 0xFF;
+    resolveInit.toMiss1                = (offsetof(ResolveStub,miss)-(offsetof(ResolveStub,toMiss1)+1)) & 0xFF;
     resolveInit.part6 [0]              = 0x4C;
     resolveInit.part6 [1]              = 0x3B;
     resolveInit.part6 [2]              = 0x50;
     resolveInit.tokenOffset            = offsetof(ResolveCacheElem,token) & 0xFF;
     resolveInit.part7 [0]              = 0x75;
-    resolveInit.toMiss2                = offsetof(ResolveStub,miss)-(offsetof(ResolveStub,toMiss2)+1) & 0xFF;
+    resolveInit.toMiss2                = (offsetof(ResolveStub,miss)-(offsetof(ResolveStub,toMiss2)+1)) & 0xFF;
     resolveInit.part8 [0]              = 0x48;
     resolveInit.part8 [1]              = 0x8B;
     resolveInit.part8 [2]              = 0x40;
index 0c596e3..97b6a38 100644 (file)
@@ -1547,7 +1547,7 @@ JIT_LOAD_DATA g_JitLoadData;
 #if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
 
 // Global that holds the path to custom JIT location
-extern "C" LPCWSTR g_CLRJITPath = nullptr;
+LPCWSTR g_CLRJITPath = nullptr;
 
 #endif // !defined(FEATURE_MERGE_JIT_AND_ENGINE)
 
index 821c938..50c9a05 100644 (file)
@@ -109,7 +109,7 @@ private:
     union
     {
         PTR_NativeCodeVersionNode m_pVersionNode;
-        struct SyntheticStorage
+        struct
         {
             PTR_MethodDesc m_pMethodDesc;
         } m_synthetic;
@@ -207,7 +207,7 @@ private:
     union
     {
         PTR_ILCodeVersionNode m_pVersionNode;
-        struct SyntheticStorage
+        struct
         {
             PTR_Module m_pModule;
             mdMethodDef m_methodDef;
index 51bce4e..a8851da 100644 (file)
@@ -201,7 +201,7 @@ template <class TKey_, class TValue_>
 /*static*/ inline INT32 GCHeapHashDependentHashTrackerHashTraits::Hash(PtrTypeKey *pValue)
 {
     LIMITED_METHOD_CONTRACT;
-    return (INT32)*pValue;
+    return (INT32)(SIZE_T)*pValue;
 }
 
 /*static*/ inline INT32 GCHeapHashDependentHashTrackerHashTraits::Hash(PTRARRAYREF arr, INT32 index)
@@ -274,7 +274,7 @@ template <class TKey>
 /*static*/ INT32 KeyToValuesGCHeapHashTraits<TRAITS>::Hash(TKey *pValue)
 {
     LIMITED_METHOD_CONTRACT;
-    return (INT32)(DWORD)*pValue;
+    return (INT32)(SIZE_T)*pValue;
 }
 
 template<class TRAITS>
@@ -924,7 +924,7 @@ template <class Visitor>
             WRAPPER_NO_CONTRACT;
 
             m_pKeysToValueHash->GetElement(index, *m_pKeyValueStore);
-            return VisitKeyValueStore(m_pLoaderAllocatorRef, m_pKeyValueStore, visitor);
+            return VisitKeyValueStore(m_pLoaderAllocatorRef, m_pKeyValueStore, m_pVisitor);
         }
     };
 
index 108c6df..53a32b5 100644 (file)
@@ -628,7 +628,7 @@ void DataImage::SaveRvaStructure()
         // rvaInfo->size are monotonically decreasing if rva are the same.
         _ASSERTE(previousRvaInfo==NULL ||
                  previousRvaInfo->rva < rvaInfo->rva ||
-                 previousRvaInfo->rva == rvaInfo->rva && previousRvaInfo->size >= rvaInfo->size
+                 ((previousRvaInfo->rva == rvaInfo->rva) && (previousRvaInfo->size >= rvaInfo->size))
                 );
 
         if (previousRvaInfo==NULL || previousRvaInfo->rva != rvaInfo->rva) {
index 5355260..4194abc 100644 (file)
 
 #ifdef FEATURE_PERFTRACING
 
-#ifndef __llvm__
+#ifndef __GNUC__
 __declspec(thread) ThreadEventBufferList ThreadEventBufferList::gCurrentThreadEventBufferList;
-#else // !__llvm__
+#else // !__GNUC__
 thread_local ThreadEventBufferList ThreadEventBufferList::gCurrentThreadEventBufferList;
-#endif // !__llvm__
+#endif // !__GNUC__
 
 EventPipeBufferManager::EventPipeBufferManager()
 {
index 386a54b..e10018f 100644 (file)
@@ -21,11 +21,11 @@ class EventPipeBufferList;
 // when the thread dies so we can free EventPipeBufferList in the destructor.  
 class ThreadEventBufferList
 {
-#ifndef __llvm__
+#ifndef __GNUC__
 __declspec(thread) static ThreadEventBufferList gCurrentThreadEventBufferList;
-#else // !__llvm__
+#else // !__GNUC__
 thread_local static ThreadEventBufferList gCurrentThreadEventBufferList;
-#endif // !__llvm__
+#endif // !__GNUC__
     EventPipeBufferList * m_pThreadEventBufferList = NULL;
     ~ThreadEventBufferList();
 
index 976a0e7..e885f1b 100644 (file)
@@ -106,7 +106,7 @@ public:
     static count_t Hash(key_t k)
     {
         LIMITED_METHOD_DAC_CONTRACT;
-        return ((count_t)k.m_methodDef ^ (count_t)k.m_module);
+        return ((count_t)k.m_methodDef ^ (count_t)(SIZE_T)k.m_module);
     }
     static const element_t Null()
     {
index c999816..096dcc4 100644 (file)
@@ -1396,7 +1396,7 @@ private:
     void RecordAndBackpatchEntryPointSlot_Locked(LoaderAllocator *mdLoaderAllocator, LoaderAllocator *slotLoaderAllocator, TADDR slot, EntryPointSlots::SlotType slotType, PCODE currentEntryPoint);
 
 public:
-    void MethodDesc::BackpatchEntryPointSlots(PCODE entryPoint)
+    void BackpatchEntryPointSlots(PCODE entryPoint)
     {
         WRAPPER_NO_CONTRACT;
         _ASSERTE(entryPoint != GetPrestubEntryPointToBackpatch());
@@ -1405,7 +1405,7 @@ public:
         BackpatchEntryPointSlots(entryPoint, false /* isPrestubEntryPoint */);
     }
 
-    void MethodDesc::BackpatchToResetEntryPointSlots()
+    void BackpatchToResetEntryPointSlots()
     {
         WRAPPER_NO_CONTRACT;
         _ASSERTE(MayHaveEntryPointSlotsToBackpatch());
index 8401ecb..7dce99d 100644 (file)
@@ -150,7 +150,7 @@ private:
         typedef CodeVersionManager * key_t;
         static key_t GetKey(const element_t &e) { return e->m_pCodeVersionManager; }
         static BOOL Equals(key_t k1, key_t k2) { return (k1 == k2); }
-        static count_t Hash(key_t k) { return (count_t)k; }
+        static count_t Hash(key_t k) { return (count_t)(SIZE_T)k; }
         static bool IsNull(const element_t &e) { return (e == NULL); }
     };
 
index 9d8eec1..8879964 100644 (file)
@@ -1674,7 +1674,7 @@ public:
 
     CORCOMPILE_FIXUP_BLOB_KIND GetKind()
     {
-        int kind = (int)GetHandle();
+        int kind = (int)(SIZE_T)GetHandle();
 
         if ((kind & 1) == 1)
         {
index 8a37282..ccb796d 100644 (file)
@@ -734,7 +734,7 @@ COUNT_T ZapImage::MethodCodeTraits::Hash(key_t k)
             case ZapNodeType_Import_ClassHandle:
             case ZapNodeType_MethodHandle:
             case ZapNodeType_Import_MethodHandle:
-                hash = ((hash << 5) + hash) ^ (COUNT_T)(pTarget);
+                hash = ((hash << 5) + hash) ^ (COUNT_T)((SIZE_T)pTarget);
                 break;
             default:
                 break;
index 5ef6bd4..358db8e 100644 (file)
@@ -209,7 +209,7 @@ private:
         static count_t Hash(key_t k) 
         {
             LIMITED_METHOD_CONTRACT;
-            return (count_t)k;
+            return (count_t)(SIZE_T)k;
         }
 
         static element_t Null() { LIMITED_METHOD_CONTRACT; return NULL; }
index 49470d3..99319ec 100644 (file)
@@ -4,8 +4,16 @@
 
 #include <windows.h>
 
+#ifndef DLLEXPORT
+#ifdef _MSC_VER
+#define DLLEXPORT __declspec(dllexport)
+#else
+#define DLLEXPORT __attribute__((visibility("default")))
+#endif
+#endif
+
 // Entrypoint jumped to by IJW dlls when their dllmain is called
-extern "C" __declspec(dllexport) BOOL WINAPI _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved)
+extern "C" DLLEXPORT BOOL WINAPI _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved)
 {
     return TRUE;
 }