Loading...

fortran@gcc.gnu.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: COMMON Blocks that are Common Across Object Modules Richard Guenther Wed Feb 29 08:00:13 2012

On Wed, Feb 29, 2012 at 4:04 PM, Knox, William J <[EMAIL PROTECTED]> wrote:
> GFortran Community,
>
> We're working on a large Fortran application under VxWorks 6.6 and compiling 
> with GFortran 4.5.1.  The legacy software is arrayed as several object 
> modules that are loaded at run-time.  Many of these object modules declare 
> the same COMMON block and expect that they will be addressing  the same area. 
>  The location of certain of these common blocks is critical and has to be 
> very specific in order to support inter-processor access of the data via 
> PCI/VME bus mapping.
>
> What we are experiencing is that as each object module is loaded (via 
> loadModule), a new definition of the symbol for a common block is added to 
> the symbol table.  After loading completes for the several object modules, 
> there are multiple definitions of the same common block symbol, each with its 
> own address.  It's clear that the COMMON block is not common across the 
> loaded object modules.  Is there some compiler/linker/loader option that can 
> force these COMMON blocks to reference the same location in memory?
>
> I can provide additional detail as necessary.  My linker/loader/GCC 
> experience is rusty and was a little thin to begin with.  Any insights would 
> be greatly appreciated.

COMMON blocks do not work across shared objects, COMMON blocks
are unified by the link editor, not by the dynamic linker.

Richard.

> Bill
>