HP3000-L Archives

May 2001, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Gavin Scott <[log in to unmask]>
Reply To:
Gavin Scott <[log in to unmask]>
Date:
Wed, 9 May 2001 10:41:43 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (58 lines)
Brian writes:
> I am compiling a module with gcc
> I want to put that module into an XL

The GCC compilers dramatically increase the range of complexity that may be
involved in doing this.  fortunately the simpler cases (C calling C) are
pretty trivial as long as you use the GCC commands to do the linking for
you.

You have the option of linking statically (;RL= style) or "shared" to
produce an XL (a.k.a. a .sl or .so, or .DLL depending on your mindset), and
you can even mix the two paradigms in a single link command.

There are multiple runtime libraries (libgcc, libc, libm, libstdc++, etc.)
that may need to be included.

When putting code into an XL, you may need to deal with shared variable
issues, especially with C++ code that expects to see only one shared version
of certain globals.  In addition, code installed in an XL that is compiled
with gcc/g++ may itself require some or all of the above runtime libraries,
requiring setting up the proper "dependent libraries" for the XL (basically
an XL for an XL).

For simple C programs it's all pretty simple fortunately and you can
generally get away with things like Mark's example.  Putting C++ code in an
XL to be called by other C++ code *will* require some help.

Also calling between C and C++ introduces issues of name mangling that C++
does to support method overloading, and how to specify the external
references correctly in each language.

For GCC related stuff, it's important to use the gcc/g++ and/or ld commands
to do your linking, since these know about things like static C++ object
initialization, which libraries GCC needs by default, etc.

We're still working to get these commands to "do the right thing" and there
are some more complex scenarios where even the GCC commands don't yet give
you what you need and you have to learn more than you'd like to about how
all of this stuff works internally (but it's good for you).

Do it yourself linker gurus may enjoy reading the dependent library
introduction in the 5.5 communicator at:

http://docs.hp.com/mpeix/onlinedocs/communicator/ix55/ct31900d.html

> it complains about missing filecode
> it assumes that XXXO is an RL, not an NMOBJ file

Most versions of LINKEDIT give a warning when given an object module with a
zero filecode, though there is at least one recent version where it got
broken and treated this as an error.  There's a patch I believe that will
fix this LINKEDIT problem if you encounter it.

G.

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2