Folks,
I hope that not too many of you are getting fed up with me going on
about HP-UX. I'm nearly there with having it working with manually
hacked Makefiles etc.
Some tweaks will be needed to the Configure tests (not too many), but
I'd just like to summarise what I believe to be the 'big picture' in a
single email.
I guess the main complexity comes from potentially having 3 C compilers
and 2 linkers. We have:
* The Bundled C compiler: which comes as standard with HP-UX,
is a K&R compiler and is pretty much just intended to generate
a new kernel. It won't be up to compiling parrot.
* A purchased HP C compiler. This is invoked with 'c89' or 'cc -Aa'.
Full C compiler.
* GNU C. Invoked with gcc or perhaps cc
Most of us know and love it.
* HP-UX linker, ld. Not sure if there is a bundled/commercial
version.
* GNU ld.
gcc may be configured to use the HP-UX or GNU linker backends.
HP-UX also has some quirks:
* Shared libraries *must* have execute permissions
* All C files which are to go into shared libraries *must* all be
compiled with 'Position Independent Code' flags
* The system ld doesn't export symbols in the main executable to be
visible to shared libraries by default
* The HP-UX linker does not like -g
* [Some strange alignment rules?]
I'll now try to clearly and concisely summarise the flags that are
required for compilation.
HP-UX C compiler:
cc: c89 or 'cc -Aa'
cc_shared: +z (should be Perl's cccdlflags variable)
ccdlflags(?): -Wl,-E if used with HP-UX ld
GCC compiler:
cc: cc or gcc
cc_shared: -fpic (Perl's cccdlflags variable)
ccdlflags(?): -Wl,-E if used with HP-UX ld
HP-UX ld:
ld: ld
ld_share_flags: -b
GNU ld:
ld: ld
ld_share_flags: -shared
The -Wl,-E (actually -E passed to ld) tells the linker to export symbols
from the resulting binary so that they are available to dynamically
loaded libraries.
-fPIC is possible instead of -fpic, and +Z -z is better than -z (thanks
H.Merijn), but we'd use whatever Perl supplies.
There basically seem to be a few assumptions in the configured system
which are a bit gcc/linux-centric.
For instance, the following files need to be compiled with $(cc_shared)
as they make their way into dynamic libraries:
src/extend.o
src/nci_test.o
dynclasses/*.o
The parrot executable need to be linked with (what I've called above)
$(ccdlflags) for dynclasses to work.
If no one sees any big misunderstands here, I'll press on with my tweaks
over the next few days,
Regards,
Nick