Skip to content

Commit

Permalink
Delete -fms-extensions from coreclr native build
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed May 30, 2024
1 parent 49c10ed commit b621127
Show file tree
Hide file tree
Showing 60 changed files with 167 additions and 189 deletions.
5 changes: 0 additions & 5 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,6 @@ if (CLR_CMAKE_HOST_UNIX)
# Disable frame pointer optimizations so profilers can get better call stacks
add_compile_options(-fno-omit-frame-pointer)

# The -fms-extensions enable the stuff like __declspec(uuid()), etc.
add_compile_options(-fms-extensions)
#-fms-compatibility Enable full Microsoft Visual C++ compatibility
#-fms-extensions Accept some non-standard constructs supported by the Microsoft compiler

# Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
# using twos-complement representation (this is normally undefined according to the C++ spec).
add_compile_options(-fwrapv)
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/binder/bindertracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace

void PopulateBindRequest(/*inout*/ BinderTracing::AssemblyBindOperation::BindRequest &request)
{
AssemblySpec *spec = request.AssemblySpec;
AssemblySpec *spec = request.AssemblySpecPtr;
_ASSERTE(spec != nullptr);

if (spec->GetName() != nullptr)
Expand Down Expand Up @@ -172,7 +172,7 @@ namespace BinderTracing

// ActivityTracker or EventSource may have triggered the system satellite load, or load of System.Private.CoreLib
// Don't track such bindings to avoid potential infinite recursion.
m_ignoreBind = t_AssemblyLoadStartInProgress && (m_bindRequest.AssemblySpec->IsCoreLib() || m_bindRequest.AssemblySpec->IsCoreLibSatellite());
m_ignoreBind = t_AssemblyLoadStartInProgress && (m_bindRequest.AssemblySpecPtr->IsCoreLib() || m_bindRequest.AssemblySpecPtr->IsCoreLibSatellite());
m_checkedIgnoreBind = true;
return m_ignoreBind;
}
Expand Down Expand Up @@ -234,12 +234,12 @@ namespace BinderTracing
bool isLastAttempt = appAssembliesAttempt == nullptr;
TraceStage(Stage::FindInLoadContext,
isLastAttempt && FAILED(m_hr) && SUCCEEDED(inContextAttempt->HResult) ? m_hr : inContextAttempt->HResult,
inContextAttempt->Assembly,
inContextAttempt->AssemblyHolder,
mvidMismatch && isLastAttempt ? errorMsg.GetUnicode() : nullptr);
}

if (appAssembliesAttempt != nullptr)
TraceStage(Stage::ApplicationAssemblies, FAILED(m_hr) && SUCCEEDED(appAssembliesAttempt->HResult) ? m_hr : appAssembliesAttempt->HResult, appAssembliesAttempt->Assembly, mvidMismatch ? errorMsg.GetUnicode() : nullptr);
TraceStage(Stage::ApplicationAssemblies, FAILED(m_hr) && SUCCEEDED(appAssembliesAttempt->HResult) ? m_hr : appAssembliesAttempt->HResult, appAssembliesAttempt->AssemblyHolder, mvidMismatch ? errorMsg.GetUnicode() : nullptr);
}

void ResolutionAttemptedOperation::TraceStage(Stage stage, HRESULT hr, BINDER_SPACE::Assembly *resultAssembly, const WCHAR *customError)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/binder/inc/bindertracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace BinderTracing

struct BindRequest
{
AssemblySpec *AssemblySpec;
AssemblySpec *AssemblySpecPtr;
SString AssemblyName;
SString AssemblyPath;
SString RequestingAssembly;
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/binder/inc/bindresult.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ namespace BINDER_SPACE
struct AttemptResult
{
HRESULT HResult;
ReleaseHolder<Assembly> Assembly;
ReleaseHolder<Assembly> AssemblyHolder;
bool Attempted = false;

void Set(const AttemptResult *result);

void Reset()
{
Assembly = nullptr;
AssemblyHolder = nullptr;
Attempted = false;
}
};
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/binder/inc/bindresult.inl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void BindResult::SetAttemptResult(HRESULT hr, Assembly *pAssembly, bool isInCont
pAssembly->AddRef();

BindResult::AttemptResult &result = isInContext ? m_inContextAttempt : m_applicationAssembliesAttempt;
result.Assembly = pAssembly;
result.AssemblyHolder = pAssembly;
result.HResult = hr;
result.Attempted = true;
}
Expand All @@ -112,11 +112,11 @@ const BindResult::AttemptResult* BindResult::GetAttempt(bool foundInContext) con

void BindResult::AttemptResult::Set(const BindResult::AttemptResult *result)
{
BINDER_SPACE::Assembly *assembly = result->Assembly;
BINDER_SPACE::Assembly *assembly = result->AssemblyHolder;
if (assembly != nullptr)
assembly->AddRef();

Assembly = assembly;
AssemblyHolder = assembly;
HResult = result->HResult;
Attempted = result->Attempted;
}
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/debug/createdump/dumpwritermacho.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ DumpWriter::BuildSegmentLoadCommands()
for (const MemoryRegion& memoryRegion : m_crashInfo.MemoryRegions())
{
uint64_t size = memoryRegion.Size();
uint32_t prot = ConvertFlags(memoryRegion.Permissions());
int32_t prot = ConvertFlags(memoryRegion.Permissions());

segment_command_64 segment = {
LC_SEGMENT_64, // uint32_t cmd;
Expand Down Expand Up @@ -240,8 +240,8 @@ DumpWriter::WriteSegments()
// Write the header
SpecialThreadInfoHeader header = {
{SPECIAL_THREADINFO_SIGNATURE},
m_crashInfo.Pid(),
m_crashInfo.Threads().size()
static_cast<uint32_t>(m_crashInfo.Pid()),
static_cast<uint32_t>(m_crashInfo.Threads().size())
};

if (!WriteData(&header, sizeof(header))) {
Expand All @@ -252,7 +252,7 @@ DumpWriter::WriteSegments()
for (const ThreadInfo* thread : m_crashInfo.Threads())
{
SpecialThreadInfoEntry entry = {
thread->Tid(),
static_cast<uint32_t>(thread->Tid()),
thread->GetStackPointer()
};

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/debug/daccess/daccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7913,7 +7913,7 @@ void DacStackReferenceWalker::WalkStack()
// Setup GCCONTEXT structs for the stackwalk.
GCCONTEXT gcctx = {0};
DacScanContext dsc(this, &mList, mResolvePointers);
dsc.pEnumFunc = DacStackReferenceWalker::GCEnumCallback;
dsc.pEnumFunc = DacStackReferenceWalker::GCEnumCallbackFunc;
gcctx.f = DacStackReferenceWalker::GCReportCallback;
gcctx.sc = &dsc;

Expand Down Expand Up @@ -7960,7 +7960,7 @@ CLRDATA_ADDRESS DacStackReferenceWalker::ReadPointer(TADDR addr)
}


void DacStackReferenceWalker::GCEnumCallback(LPVOID hCallback, OBJECTREF *pObject, uint32_t flags, DacSlotLocation loc)
void DacStackReferenceWalker::GCEnumCallbackFunc(LPVOID hCallback, OBJECTREF *pObject, uint32_t flags, DacSlotLocation loc)
{
GCCONTEXT *gcctx = (GCCONTEXT *)hCallback;
DacScanContext *dsc = (DacScanContext*)gcctx->sc;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/daccess/dacimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,7 @@ class DacStackReferenceWalker : public DefaultCOMImpl<ISOSStackRefEnum, IID_ISOS

private:
static StackWalkAction Callback(CrawlFrame *pCF, VOID *pData);
static void GCEnumCallback(LPVOID hCallback, OBJECTREF *pObject, uint32_t flags, DacSlotLocation loc);
static void GCEnumCallbackFunc(LPVOID hCallback, OBJECTREF *pObject, uint32_t flags, DacSlotLocation loc);
static void GCReportCallback(PTR_PTR_Object ppObj, ScanContext *sc, uint32_t flags);

CLRDATA_ADDRESS ReadPointer(TADDR addr);
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/debug/di/rsthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,11 @@ void CordbThread::Get32bitFPRegisters(CONTEXT * pContext)
for (i = 0; i <= floatStackTop; i++)
{
double td = 0.0;
#ifdef _MSC_VER
__asm fstp td // copy out the double
#else
__asm("fstpl %0" : "=m" (td));
#endif
m_floatValues[i] = td;
}

Expand Down
12 changes: 12 additions & 0 deletions src/coreclr/debug/di/valuehome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,19 @@ void FloatRegValueHome::SetEnregisteredValue(MemoryRange newValue,

while (i <= m_floatIndex)
{
#ifdef _MSC_VER
__asm fstp td
#else
__asm("fstpl %0" : "=m" (td));
#endif
popArea[i++] = td;
}

#ifdef _MSC_VER
__asm fld newVal; // push on the new value.
#else
__asm("fldl %0" : "=m" (newVal));
#endif

// Push any values that we popled off back onto the stack,
// _except_ the last one, which was the one we changed.
Expand All @@ -531,7 +539,11 @@ void FloatRegValueHome::SetEnregisteredValue(MemoryRange newValue,
while (i > 0)
{
td = popArea[--i];
#ifdef _MSC_VER
__asm fld td
#else
__asm("fldl %0" : "=m" (td));
#endif
}

// Save out the modified float area.
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/debug/ee/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13962,7 +13962,11 @@ void GenericHijackFuncHelper()
// must be naked.
//
#if defined(TARGET_X86)
#ifdef TARGET_WINDOWS
__declspec(naked)
#else
__attribute__((naked))
#endif
#endif // defined (_x86_)
void Debugger::GenericHijackFunc(void)
{
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/debug/ee/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@
#include "frameinfo.h"
#include <corerror.h>
#include "../inc/common.h"

17 changes: 6 additions & 11 deletions src/coreclr/inc/check.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,18 +576,13 @@ CHECK CheckValue(TYPENAME &val)
#define UNREACHABLE() \
UNREACHABLE_MSG("")

#ifdef __llvm__
#define UNREACHABLE_RET() \
UNREACHABLE(); \
return 0

// LLVM complains if a function does not return what it says.
#define UNREACHABLE_RET() do { UNREACHABLE(); return 0; } while (0)
#define UNREACHABLE_MSG_RET(_message) UNREACHABLE_MSG(_message); return 0;

#else // __llvm__

#define UNREACHABLE_RET() UNREACHABLE()
#define UNREACHABLE_MSG_RET(_message) UNREACHABLE_MSG(_message)

#endif // __llvm__ else
#define UNREACHABLE_MSG_RET(_message) \
UNREACHABLE_MSG(_message); \
return 0

#ifdef _DEBUG_IMPL

Expand Down
18 changes: 9 additions & 9 deletions src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2120,10 +2120,10 @@ class ProducingStreamBaseInstrs
}

private:
const regNumber intReg1;
const regNumber intReg2;
const regNumber addrReg;
emitter* const emitter;
const regNumber intReg1;
const regNumber intReg2;
const regNumber addrReg;
class emitter* const emitter;
};

class ProducingStream
Expand Down Expand Up @@ -2213,11 +2213,11 @@ class ProducingStream
}

private:
const regNumber intReg1;
const regNumber simdReg1;
const regNumber simdReg2;
const regNumber addrReg;
emitter* const emitter;
const regNumber intReg1;
const regNumber simdReg1;
const regNumber simdReg2;
const regNumber addrReg;
class emitter* const emitter;
};

class BlockUnrollHelper
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -4668,7 +4668,7 @@ struct NewCallArg
// The class handle if SignatureType == TYP_STRUCT.
CORINFO_CLASS_HANDLE SignatureClsHnd = NO_CLASS_HANDLE;
// The type of well known arg
WellKnownArg WellKnownArg = ::WellKnownArg::None;
enum class WellKnownArg WellKnownArg = ::WellKnownArg::None;

NewCallArg WellKnown(::WellKnownArg type) const
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/inductionvariableopts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class LoopLocalOccurrences
struct Occurrence
{
BasicBlock* Block;
Statement* Statement;
struct Statement* Statement;
GenTreeLclVarCommon* Node;
Occurrence* Next;
};
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/jitstd/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class allocator<void>
template <typename U>
struct rebind
{
typedef allocator<U> allocator;
typedef class allocator<U> allocator;
};

private:
Expand Down Expand Up @@ -105,7 +105,7 @@ class allocator
template <typename U>
struct rebind
{
typedef allocator<U> allocator;
typedef class allocator<U> allocator;
};

private:
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1217,8 +1217,8 @@ void NodeCounts::record(genTreeOps oper)

struct DumpOnShutdownEntry
{
const char* Name;
Dumpable* Dumpable;
const char* Name;
class Dumpable* Dumpable;
};

static DumpOnShutdownEntry s_dumpOnShutdown[16];
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Runtime/eventpipe/ds-rt-aot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ aot_ipc_get_process_id_disambiguation_key(
// since the start of the Unix epoch).
struct kinfo_proc info = {};
size_t size = sizeof (info);
int mib [4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_id };
int mib [4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int32_t)process_id };

const int result_sysctl = sysctl (mib, sizeof(mib)/sizeof(*mib), &info, &size, NULL, 0);
if (result_sysctl == 0) {
Expand Down
10 changes: 9 additions & 1 deletion src/coreclr/nativeaot/Runtime/stressLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ GPTR_IMPL(StressLog, g_pStressLog /*, &StressLog::theLog*/);
variable-speed CPUs (for power management), this is not accurate, but may
be good enough.
*/
inline __declspec(naked) uint64_t getTimeStamp() {

inline
#ifdef TARGET_WINDOWS
__declspec(naked)
#else
__attribute__((naked))
#endif
uint64_t getTimeStamp()
{

__asm {
RDTSC // read time stamp counter
Expand Down
10 changes: 1 addition & 9 deletions src/coreclr/pal/inc/mbusafecrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ typedef int errno_t;
// define the return value for success
#define SAFECRT_SUCCESS 0

#ifndef THROW_DECL
#if defined(_MSC_VER) || defined(__llvm__) || !defined(__cplusplus)
#define THROW_DECL
#else
#define THROW_DECL throw()
#endif // !_MSC_VER
#endif // !THROW_DECL

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -75,7 +67,7 @@ extern int _vsnprintf_s( char* string, size_t sizeInBytes, size_t count, const c
extern int sscanf_s( const char *string, const char *format, ... );
extern int swscanf_s( const WCHAR *string, const WCHAR *format, ... );

extern errno_t memcpy_s( void * dst, size_t sizeInBytes, const void * src, size_t count ) THROW_DECL;
extern errno_t memcpy_s( void * dst, size_t sizeInBytes, const void * src, size_t count );
extern errno_t memmove_s( void * dst, size_t sizeInBytes, const void * src, size_t count );

extern errno_t _wcslwr_s(char16_t *string, size_t sz);
Expand Down
Loading

0 comments on commit b621127

Please sign in to comment.