-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
…loc in src/zap/zaprelocs.cpp
…_PTR in src/zap/zapinfo.cpp
…_PTR in src/zap/zaprelocs.cpp
src/zap/zapimport.cpp
Outdated
@@ -363,12 +363,12 @@ void ZapImport::Save(ZapWriter * pZapWriter) | |||
if (IsReadyToRunCompilation()) | |||
{ | |||
SIZE_T value = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use type that is of the right target pointer size, not SIZE_T
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(multiple places)
src/zap/zapinfo.cpp
Outdated
@@ -2574,7 +2574,11 @@ void ZapInfo::recordRelocation(void *location, void *target, | |||
break; | |||
|
|||
case IMAGE_REL_BASED_PTR: | |||
#ifdef _TARGET_64BIT_ | |||
*(UNALIGNED TADDR *)location = (TADDR)targetOffset; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use int64 instead TADDR now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(multiple places)
src/zap/zapimport.cpp
Outdated
@@ -362,12 +362,12 @@ void ZapImport::Save(ZapWriter * pZapWriter) | |||
{ | |||
if (IsReadyToRunCompilation()) | |||
{ | |||
SIZE_T value = 0; | |||
target_size_t value = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks odd to use target_size_t
for all these since none of them are actually sizes.
Would TARGET_POINTER
or TARGET_POINTER_TYPE
be a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason I had in mind when picked target_size_t
is to be consistent with clrjit where we already have target_size_t
typedef. I renamed this to TARGET_POINTER_TYPE
in src/zap
* Cast to UINT32 to avoid warnings on Windows in ZapBaseRelocs::WriteReloc in src/zap/zaprelocs.cpp * Replace TADDR with DWORD in ZapInfo::recordRelocation IMAGE_REL_BASED_PTR in src/zap/zapinfo.cpp * Replace sizeof(cell) with TARGET_POINTER_SIZE in src/zap/zapimport.cpp * Replace TADDR with DWORD in ZapBaseRelocs::WriteReloc IMAGE_REL_BASED_PTR in src/zap/zaprelocs.cpp * Define target_size_t type * Replace TADDR with target_size_t in ZapInfo::recordRelocation in src/zap/zapinfo.cpp * Replace SIZE_T PVOID with target_size_t in src/zap/zapimport.cpp * Replace TADDR with target_size_t in src/zap/zaprelocs.cpp * Rename target_size_t to TARGET_POINTER_TYPE Commit migrated from dotnet/coreclr@1a24a27
TADDR
is defined astypedef ULONG_PTR TADDR
in VM and it seems to me that it's almost impossible to use target-specific typedef forTADDR
. In this PR I identified small number of places in src/zap whereTADDR
is used for writing relocation records to PE image and replaced those withDWORD
keeping the rest of CoreCLR untouched. As usually, I validated these changes on CoreLib and CoreFX assemblies (incl. test assemblies) by checking that output of x86_arm and x64_arm crossgens are identical.@jkotas Do you think this is a right approach?