zilch-lang / nstar

The compiler for N⋆, a statically typed assembly language used as a compiler backend for Zilch
BSD 3-Clause "New" or "Revised" License
28 stars 2 forks source link

Dynamically and statically linked symbols #26

Closed Mesabloo closed 3 years ago

Mesabloo commented 3 years ago

as (the GNU assembler) resolves whether procedures are statically or dynamically linked with some annotations. Statically linked procedures are just imported in the scope with .extern <procedure_name>, while dynamically linked procedures must be refered to as offsets of either the PLT (Procedure Linkage Table) or the GOT (Global Offset Table).

This solution really shows the inner mecanisms of the name resolution, but is a bit hard to understand, and to directly use in an assembly language.

I plan on using special directives (static <procedure>: <type> and dynamic <procedure>: <type>) to abstract away all the details about the .plt, .got.plt, .plt.got, .rel(a).dyn and .rel(a).text sections for easier use of the language. Those mecanisms will be hidden in the compiler and all the necessary sections will be generated at compile-time, if needed.

Mesabloo commented 3 years ago

Closed as it is now stated here.