[Lazarus] Attn. Mattias, adding x86 CPU detection function to DefineTemplates.pas

Maxim Ganetsky ganmax at narod.ru
Thu Nov 23 02:11:30 CET 2023


Hello.

I am trying to solve 
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/38786 
(Lazarus emits x86-specific assembler mode compiler option for non-x86 
CPUs).

In order to solve it, I need to add the following function to 
DefineTemplates.pas:

function IsCPUX86(TargetCPU: string): boolean;
begin
   TargetCPU := GetFPCTargetCPU(TargetCPU);
   Result:=(TargetCPU='i8086') or (TargetCPU='i386') or 
(TargetCPU='x86_64');
end;

The questions are:

1. Is it correct place?
2. Is its name OK?
3. Maybe I missed some existing function?

The complete patch is attached in the issue.

-- 
Best regards,
  Maxim Ganetsky                  mailto:ganmax at narod.ru


More information about the lazarus mailing list