gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

linking update


From: Gaius Mulley
Subject: linking update
Date: Wed, 20 Jul 2022 23:35:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hello everyone,

I'm about to git push a significant number of changes onto the
devel/modula-2 branch (of gcc-13):

  $ git clone git://gcc.gnu.org/git/gcc.git gcc-git-devel-modula2
  $ cd gcc-git-devel-modula2
  $ git checkout devel/modula-2
  $ cd ..

hopefully they will appear in the next day or so.  In summary these
changes all pass on x86_64 debian stable

                === gm2 Summary ===

# of expected passes            11736
runtest completed at Wed Jul 20 23:05:41 2022

and mark the point at which the new dynamic scaffold is complete.  The
major change for dynamic scaffold is that the tools gm2l and friends are
now part of cc1gm2 - and in due course the binaries
gm2l/gm2lcc/gm2m/gm2order/gm2lgen can be removed.  Also the driver gm2
has been rewritten.

I've included a node in the gm2.texi explaining some of the linking
flags - included here for completeness.  If you're interested it is
possible to single step the dependency resolution in the dynamic
scaffold and watch the program counter hop from one import statement to
the next.

The previous static scaffold can be used if desired (-fscaffold-static).

Feel free to ask questions or feedback wishes etc,

regards,
Gaius

-----------------

@node Linking, Building a shared library, Unbounded by reference, Using

This section describes the linking related options.  There are three
linking strategies available which are dynamic scaffold, static
scaffold and user defined.  The dynamic scaffold is enabled by default
and each module will register itself to the runtime @samp{M2RTS} via
a constructor.  The static scaffold mechanism will invoke each modules
@samp{_init} and @samp{_finish} function in turn via a sequence of
calls from within @samp{main}.  Lastly the user defined strategy
can be implemented by turning off the dynamic and static options via
@samp{-fno-scaffold-dynamic} and @samp{-fno-scaffold-static}.

In the simple test below:

@example
$ gm2 hello.mod
@end example

the driver will add the options @samp{-fscaffold-dynamic} and
@samp{-fgen-module-list=-} which generate a list of application
modules and also creates the @samp{main} function with calls to
@samp{M2RTS}.  It can be useful to add the option @samp{-fsources}
which displays the source files as they are parsed and summarizes
whether the source file is required for compilation or linking.

If you wish to split the above command line into a compile and link
then you could use these steps:

@example
$ gm2 -c -fscaffold-main hello.mod
$ gm2 hello.o
@end example

The @samp{-fscaffold-main} informs the compiler to generate the
@samp{main} function and scaffold.  You can enable the environment
variable @samp{GCC_M2LINK_RTFLAG} to trace the construction and
destruction of the application.  The values for
@samp{GCC_M2LINK_RTFLAG} are shown in the table below:

@example
value   | meaning
=================
all     | turn on all flags below
module  | trace modules as they register themselves
pre     | generate module list prior to dependency resolution
dep     | trace module dependency resolution
post    | generate module list after dependency resolution
force   | generate a module list after dependency and forced
        | ordering is complete
@end example





reply via email to

[Prev in Thread] Current Thread [Next in Thread]