省略汇编函数的汇编关键字

Omit assembler keyword for assembler functions

是否有一个我没有看到的编译器开关允许我从汇编函数中省略汇编关键字?

我现在是怎么做的,使用 FPC 文档中的示例:

function geteipasebx : pointer;assembler;  
asm  
  movl (%esp),%ebx  
  ret  
end;

我想怎么做:

function geteipasebx : pointer;
asm  
  movl (%esp),%ebx  
  ret  
end; 

这可以做到吗?

编辑:
编译器源文件 PSUB.PAS 第 170 行:

{ do we have an assembler block without the po_assembler?
  we should allow this for Delphi compatibility (PFV) }
 if (token=_ASM) and (m_delphi in current_settings.modeswitches) then
  include(current_procinfo.procdef.procoptions,po_assembler);

{ Handle assembler block different }
 if (po_assembler in current_procinfo.procdef.procoptions) then ...

我相信free pascal的这部分源代码意味着这只能在{$MODE DELPHI}中完成。

是的,这是可以做到的。您必须将编译器兼容模式设置为 DELPHI 并将 asm 语法重新定义为 ATT,因为模式 DELPHI 会将其覆盖为 INTEL.

更具体地说,程序:

program Project1;
{$MODE DELPHI}
{$ASMMODE ATT}
function geteipasebx : pointer;
asm
  movl (%esp),%ebx
  ret
end;

var
  p: pointer;
begin
  p := geteipasebx;
end.

编译并且运行很好。