[fpc-devel] Internal assembler: tai_directive usage

dmitry boyarintsev skalogryz.lists at gmail.com
Mon Nov 9 11:50:31 CET 2009

Hello Developers.

The internal assembler seems to ignore any kind of assembler directives.
For darwin asm, some directives are macros to declare a new section.
I.e. asd_non_lazy_symbol_pointer, starts are new section for indirect symbols.

Would it be correct to replace directives, with a proper Tai_section
element, like in the example below?
Or is there any other proper way?

(note: i've had to add an additional section type: sec_data_nonlazy)

> procedure replaceai(oldai, newai: Tai);
>  var
>    p : tai;
>  begin
>    if not assigned(oldai) or not assigned(newai) then Exit;
>    p:=tai(oldai.Previous);
>    if Assigned(p) then p.next:=newai;
>    newai.Next:=oldai.Next;
>    newai.Previous:=oldai.Previous;
>    oldai.Next:=nil;
>    oldai.Previous:=nil;
>  end;

>function TInternalAssembler.TreePass0(hp:Tai):Tai;
> ...
>   while assigned(hp) do
>   begin
>     case hp.typ of
>      ...
>       ait_directive :
>         case tai_directive(hp).directive of
>           asd_non_lazy_symbol_pointer:
>           begin
>             {creating a new section, getting name and align from ObjData}
>             newai:=tai_section.Create(sec_data_nonlazy, ObjData.sectionname(sec_data_nonlazy, '', secorder_default), ObjData.sectiontype2align(sec_data_nonlazy));
>             replaceai(hp, newai);
>             hp.Free;
>             hp:=newai;
>             {make the loop to process new tai_section again. hp.next must not be callsed}
>             Continue;
>           end;
>         end;
>     end; {of case hp.typ}
>     hp:=Tai(hp.next);
>   end; {of while}


More information about the fpc-devel mailing list