Steve,
Here's a guess: this code is a neat way to link the dynamic linker library
into poplog, so that the runtlime system can do dynamic linking. At runtime
this is a bit perverse (because you would need the dynamic linker already
in place to perform the link) and also fails because it tries to assign a
reference to exload_dummy, as you discovered. At build time, however, the
link doesn't get done straight away - it just creates additional link data
that is eventually linked by the *static* link process. In addition,
because exload_dummy is lexical and not referenced elsewhere, I would guess
that no dereferencing code is ever generated for it, so the system never
notices that it wasn't found in the link. If this guess is right, then the
offending code should be wrapped in #_IF DEF POPC (or whatever the test for
POPC compilation is..)
Roger
Stephen Isard wrote:
> I've been poking around in source code and found, in
> $popsrc/extern_symbols.p, lines 28-30,
>
> exload dl [^DL_LIB]
> lconstant exload_dummy; ;;; anything will do
> endexload;
>
> They are preceded by the comment
> /* dummy external load to force linking against the dynamic linker
> library
> and DL_LIB has been assigned the value 'ldl' in $popsrc/external.ph.
>
> Can someone explain to me what is being achieved here?
>
> The lines won't load in ordinary pop11 - you get an error message
>
> Error: can't find value for symbol exload_dummy
>
> That's not a problem in itself because the file is meant to be compiled
> with popc rather than the normal pop11 compiler. But what is getting
> added to the pop11 binary as the result of trying to reference a
> non-existent symbol in the dynamic linker
> library? And at what stage of compiling/linking is the dummy reference
> attempted?
>
> Thanks for any enlightenment you can provide.
>
> Stephen Isard
|