NO

Author Topic: ARM64 support  (Read 1099 times)

Offline CandCPlusPlus

  • Member
  • *
  • Posts: 71
ARM64 support
« on: January 01, 2025, 03:06:37 AM »
One feature that is definitely relevant to Pelles C is ARM64. Microsoft now has builds of Windows 11 and Windows Server 2025 for ARM64. It would be useful if the Intel/AMD x64 build of Pelles C could compile ARM64 code. It would also be useful if both intel/AMD x64 and ARM64 builds of Pelles C with the IDE existed.
« Last Edit: January 01, 2025, 06:35:40 AM by CandCPlusPlus »

Offline HellOfMice

  • Member
  • *
  • Posts: 313
  • Never be pleased, always improve
Re: ARM64 support
« Reply #1 on: January 01, 2025, 02:08:54 PM »
Don't forget the Assembler :P
--------------------------------
Kenavo

Offline John Z

  • Member
  • *
  • Posts: 954
Re: ARM64 support
« Reply #2 on: January 01, 2025, 04:36:02 PM »
Hi CandCPlusPlus,

Welcome back  -

While you were away things have changed.

Pelle has gone on either a long, or permanent sabbatical, and may or may not ever return.
The Pelles C software is not open source.  So the only enhancements in the current future can only come from Add-ins.

IMO ARM 64 is an ask too far, and not having it won't impact Pelles C use for a long, long time, if ever.  Windows on ARM will need to support x86, and x64 transitions layer forever.  There is just too much software out there for MS Windows which won't be discarded by not being coded in ARM.  I don't discount the future advantage to coding in native ARM for some cases, but non-ARM system count will be greater than ARM systems for a long time to come.

 John Z

Offline CandCPlusPlus

  • Member
  • *
  • Posts: 71
Re: ARM64 support
« Reply #3 on: January 01, 2025, 05:56:50 PM »
That's definitely true. Even if all Windows computers were suddenly ARM64, Microsoft is not going to be able to remove Intel/AMD x64 support for decades if ever.  That will likely even be true of Intel/AMD x86 as well. The ARM64 builds of Windows will need a compatibility layer for x86 and x64 code well into the future.

There can be performance benefits to running natively on ARM64 though and there could be performance benefits to having a native ARM64 build of Pelles C with the IDE.

Edit: I *believe* native ARM64 builds can reduce battery usage as well.
« Last Edit: January 01, 2025, 06:30:24 PM by CandCPlusPlus »

Offline CandCPlusPlus

  • Member
  • *
  • Posts: 71
Re: ARM64 support
« Reply #4 on: January 01, 2025, 06:18:04 PM »
I just realized that the 64-bit builds of Windows have already existed for a longer time period than it took for 32-bit builds to be replaced. The first 32-bit version was Windows NT 3.1 which was released in 1993 and the first 64-bit version was Windows XP x64 which was released in 2005. It took 12 years for 32-bit builds to be made obsolete and it has been almost 20 years since the release of Windows XP x64. Windows 7 was released in 2009 which made 64-bit more mainstream and Windows 7 will be 16 years old this year.

Despite all this, Windows still includes a 32-bit compatibility layer and there's still a lot of 32-bit software out there.

Edit: Another factor to consider is that unlike x64 hardware replacing x86 hardware, ARM64 is not completely replacing x64 hardware. Both are likely to be used well into the future.
« Last Edit: January 01, 2025, 06:23:20 PM by CandCPlusPlus »

Offline HellOfMice

  • Member
  • *
  • Posts: 313
  • Never be pleased, always improve
Re: ARM64 support
« Reply #5 on: January 01, 2025, 06:22:24 PM »
I am writing a program for analyzing 64 bits programs. I thought I will find a lot, that's false, 32 bits programs are numerous. :-\
--------------------------------
Kenavo

Offline CandCPlusPlus

  • Member
  • *
  • Posts: 71
Re: ARM64 support
« Reply #6 on: January 01, 2025, 06:51:08 PM »
I still have several programs I use that are 32-bit. One of them only this month got a beta unstable 64-bit build that's being worked on.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2189
Re: ARM64 support
« Reply #7 on: January 01, 2025, 07:15:43 PM »
Some time ago i wanted to know .Net programs in folder
Code: [Select]
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>

int ScanDirs(char *szDir);
int ProcessFile(TCHAR *szFile);
int CheckFile(PBYTE pMem, TCHAR *szFile);

TCHAR szPath[MAX_PATH];
int nCount = 0;

int __cdecl main(int argc, char **argv)
{
if (argc < 2) return 1;
strcpy(szPath, argv[1]);
ScanDirs(szPath);
printf("count: %d\n", nCount);
return 0;
}

int ScanDirs(char *szDir)
{
WIN32_FIND_DATA fdFile;
HANDLE hFile;
int i;
// char szTmp[MAX_PATH];

i = 0;
int nLen = lstrlen(szDir);
lstrcpy(szDir+nLen, "\\*.*");
hFile = FindFirstFile(szDir, &fdFile);
if (hFile != INVALID_HANDLE_VALUE)
do {
if ((fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
!= FILE_ATTRIBUTE_DIRECTORY) {
//puts(fdFile.cFileName);
*(szDir+nLen) = '\\';
lstrcpy(szDir+nLen+1, fdFile.cFileName);
//puts(szDir);
ProcessFile(szDir);
i++;
} else {
BOOL bPDir;
if (*fdFile.cFileName == '.') {
if (!*(fdFile.cFileName+1)) bPDir = TRUE;
else if (*(fdFile.cFileName+1) == '.' && !*(fdFile.cFileName+2)) bPDir = TRUE;
else bPDir = FALSE;
} else bPDir = FALSE;
if (!bPDir) {
*(szDir+nLen) = '\\';
lstrcpy(szDir+nLen+1, fdFile.cFileName);
//puts(szDir);
ScanDirs(szDir); // recursion
*(szDir + nLen) = 0; // previous level
}
}
} while (FindNextFile(hFile, &fdFile));
FindClose(hFile);
return 0;
}

int ProcessFile(TCHAR *szFile)
{
HANDLE hFile, hMapping;
VOID *pMem;

hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
hMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
if (hMapping)
{
pMem = MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0);
if (pMem)
{
CheckFile(pMem, szFile);
UnmapViewOfFile(pMem);
} else
puts("File open error");
CloseHandle(hMapping);
} else
puts("FileMapping error");
} else
puts("File open error");
return 0;
}

int CheckFile(PBYTE pMem, TCHAR *szFile)
{
PIMAGE_DOS_HEADER pDosHdr;
PIMAGE_NT_HEADERS pNtHdrs;
PIMAGE_NT_HEADERS64 pNtHdrs64;
DWORD dwRVAdr;
pDosHdr = (PIMAGE_DOS_HEADER)pMem;
if (pDosHdr->e_magic != IMAGE_DOS_SIGNATURE)
return 1;
pNtHdrs = (PIMAGE_NT_HEADERS)(pMem+pDosHdr->e_lfanew);
if (pNtHdrs->Signature != IMAGE_NT_SIGNATURE)
return 2;
pNtHdrs64 = (PIMAGE_NT_HEADERS64)pNtHdrs;
BOOL bIs64Bit = ( pNtHdrs->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC );
if (bIs64Bit) dwRVAdr = (DWORD)((PIMAGE_NT_HEADERS64)(pNtHdrs))->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress;
else dwRVAdr = (DWORD)((PIMAGE_NT_HEADERS32)(pNtHdrs))->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress;
if (!dwRVAdr) return 2;
puts(szFile);
nCount++;
return 0;
}

BTW:
The first AMD64-based processor, the Opteron, was released in April 2003.
« Last Edit: January 01, 2025, 07:17:20 PM by TimoVJL »
May the source be with you

Offline Vortex

  • Member
  • *
  • Posts: 942
    • http://www.vortex.masmcode.com
Re: ARM64 support
« Reply #8 on: January 01, 2025, 07:18:36 PM »
Talking about ARM64, here is an interesting project :

Quote
Run virtual machines on iOS

Emulate any Processor
30+ processors supported by qemu including x86_64, ARM64, and RISC-V

Run any Operating System
Windows, Linux, and more natively and securely on iOS within an App

https://getutm.app/
Code it... That's all...

Offline MrBcx

  • Global Moderator
  • Member
  • *****
  • Posts: 197
    • Bcx Basic to C/C++ Translator
Re: ARM64 support
« Reply #9 on: January 01, 2025, 09:07:10 PM »
One feature that is definitely relevant to Pelles C is ARM64. Microsoft now has builds of Windows 11 and Windows Server 2025 for ARM64. It would be useful if the Intel/AMD x64 build of Pelles C could compile ARM64 code. It would also be useful if both intel/AMD x64 and ARM64 builds of Pelles C with the IDE existed.

Maybe you will find this useful:

https://github.com/mstorsjo/llvm-mingw


Benefits of a LLVM based MinGW toolchain are:

    Support for targeting ARM/ARM64 (while GCC obviously does support these architectures, it doesn't support Windows on ARM)

    A single toolchain targeting all four architectures (i686, x86_64, armv7 and arm64) instead of separate compiler binaries for each architecture


Bcx Basic to C/C++ Translator
https://www.BcxBasicCoders.com

Offline CandCPlusPlus

  • Member
  • *
  • Posts: 71
Re: ARM64 support
« Reply #10 on: January 01, 2025, 09:16:04 PM »
A tiny counterpoint to my earlier posts is that ARM64 support has happened rather quickly. There is a native ARM64 build of 7-Zip and countless other applications. There is already a native ARM64 build of Visual Studio and the Microsoft C++ Compiler can compile ARM64 code. Pelles C did support ARM32 at one point when ARM32 was quite niche and ARM64 is becoming mainstream.
« Last Edit: January 01, 2025, 10:04:51 PM by CandCPlusPlus »