improved i486 detection

This commit is contained in:
2026-01-09 21:50:26 +02:00
parent ab6049d027
commit 7c3f154b15

View File

@@ -1,6 +1,13 @@
#include "target.h" #include "target.h"
#include "tier0/commandline.h" #include "tier0/commandline.h"
#include "tier1/utlstring.h" #include "tier1/utlstring.h"
#include "sys/utsname.h"
// see Target_t::HostTarget
#if defined(__i386__) && defined(POSIX)
static utsname s_uname;
static int s_iuNameRes = uname(&s_uname);
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Generates triplet suitable for most compilers. // Generates triplet suitable for most compilers.
@@ -112,6 +119,8 @@ const char *Target_t::GetDynamicLibraryFileFormat()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Returns target on which fpc is being run // Returns target on which fpc is being run
//
// For targets such as i386, i486, i586
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Target_t Target_t::HostTarget() Target_t Target_t::HostTarget()
{ {
@@ -136,17 +145,19 @@ ETargetCPU cpu =
#endif #endif
#if defined(__i386__) #if defined(__i386__)
TARGET_CPU_80386 TARGET_CPU_80386
#endif
#if defined(__i486__)
TARGET_CPU_80486
#endif
#if defined(__i586__)
TARGET_CPU_80586
#endif
#if defined(__i686__)
TARGET_CPU_80686
#endif #endif
; ;
// POSIX doesn't know about these
// use uname to get them
#if defined(__i386__) && defined(POSIX)
if (!V_strcmp("i486", s_uname.machine))
cpu = TARGET_CPU_80486;
if (!V_strcmp("i586", s_uname.machine))
cpu = TARGET_CPU_80486;
if (!V_strcmp("i686", s_uname.machine))
cpu = TARGET_CPU_80486;
#endif
return { return {
.kernel = kernel, .kernel = kernel,
.cpu = cpu, .cpu = cpu,