Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2009-11

Internal assembler: tai_directive usage

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

dmitry boyarintsev

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)

{

Show quoted text 35 lines
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}

}

thanks,
dmitry

Reply by email

Jonas Maebe
to dmitry boyarintsev
dmitry boyarintsev wrote 5 lines
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.

The main reason is that I added these directives without any knowledge of what they actually do at the object level. I just read the assembler manual, saw the syntax and added them (which is very convenient, and one of the reasons why I'm not a big fan of an internal assembler unless it's really required).

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?

If some of these directives simply create a new section, then the directives can be removed and everywhere they are currently used in the compiler you can create the appropriate section instead (you can submit this in a separate patch).

Jonas

Reply by email

dmitry boyarintsev
to Jonas Maebe
Jonas Maebe wrote 5 lines
The main reason is that I added these directives without any knowledge of what they actually do at the object level. I just read the assembler manual, saw the syntax and added them (which is very convenient, and one of the reasons why I'm not a big fan of an internal assembler unless it's really required).

I see the point. Using external tools have their advantage.

Just some people would like to have an easy macosx cross-compilation, as well as better compilation performance.

If some of these directives simply create a new section, then the directives can be removed and everywhere they are currently used in the compiler you can create the appropriate section instead (you can submit this in a separate patch).

Yes, i'll make a patch to replace directives with sections

The list of "macro section" directives can be found at this link ("Built-in Directives"):
http://developer.apple.com/mac/library/documentation/DeveloperTools/Reference/Assembler/040-Assembler_Directives/asm_directives.html#//apple_ref/doc/uid/TP30000823-CJBDFFDF

thanks,
dmitry

Reply by email

Jonas Maebe
to dmitry boyarintsev
dmitry boyarintsev wrote
Just some people would like to have an easy macosx cross-compilation, as well as better compilation performance.

For the performance part, there's another thing that could be done (although the result will of course still be slower than an internal assembler): generate assembler code that does not need preprocessing. See the -f option in "man as".

Jonas

Reply by email