[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] Pure bfd checked in
From: |
Camm Maguire |
Subject: |
Re: [Gcl-devel] Pure bfd checked in |
Date: |
14 Jun 2002 11:08:50 -0400 |
Greetings!
"Mike Thomas" <address@hidden> writes:
> Hi Camm.
>
> I'm trying to come to grips with the new BFD work you have done for the
> Mingw32 port of GCL, but would like some help on how it works and what it
> is.
>
> As things stand, configure correctly detects the BFD lib and header and for
> now I have hand patched the mingw header and other files such as rsym_nt.c.
> GCL seems to be built corectly and I can define a simple test function and
> compile it from the command line. Is that a sufficient test for the new
> system?
OK, the configure changes I've made *should* not change any builds
unless changes are made in the .h/.defs files. What I'm aiming for
is:
1) configure autodetects everything, and makes sane defaults for an
optimal build -- #defines in h/gclincl.h, makefile in makedefs
2) .h file *overrides* gclincl.h (and is copied and used as config.h).
For example, one need not define LITTLE_END anymore, as configure
will do it for you in gclincl.h. But you can override in <arch>.h
with #undef and/or #define if you wish.
3) .defs *overrides* makedefs similarly
4) If bfd is detected, configure will define HAVE_LIBBFD and include
the bfd headers. Eventually, I'd also like it to #define
SEPARATE_FASL_FILE to "sfaslbfd.c" and to #define SFASL. But doing
so now without changes in all the .h files will lead to compile
warnings, so I've delayed this. So basically your fasl will be as
before unless you change your .h. Here is what I have now for
i386-linux.h:
#ifdef HAVE_LIBBFD
#define SEPARATE_SFASL_FILE "sfaslbfd.c"
#else
#define SPECIAL_RSYM "rsym_elf.c"
#define SEPARATE_SFASL_FILE "sfaslelf.c"
#endif
The .c code which does the relocations works like this: if
SPECIAL_RSYM is defined, do not initialize bfd, and do not build a
bfd symbol table, but rather use the specified rsym to do so as was
used in the past. rsym reads the raw_gcl image, and makes a table
of its symbols and their address to be used in relocating loaded .o
files later. If SPECIAL_RSYM is not defined, and HAVE_LIBBFD is
defined, then use bfd to build the symbol table. If both are
undefined, give a compilation error. For fasloading, sfaslbfd.c
will insist that SPECIAL_RSYM is undefined and that HAVE_LIBBFD is,
nameley, that bfd has been initialized and can be used for the
relocation calls which sfaslbfd.c is about to make. Likewise,
sfaslelf.c should also insist that SPECIAL_RSYM has been defined,
as the symbol table it expects is the old version and is
different. This check has not been implemented yet, but basically
that is the old behavior, for one could define SEPARATE_FASL_FILE
to "sfaslelf.c" and leave the SPECIAL_RSYM undefined.
For arches where sfaslelf.c does not yet work (nor likely ever
will), (i.e. everywhere but i386 and sparc), here is what I have,
e.g. in powerpc-linux.h:
/* #define SPECIAL_RSYM "rsym_elf.c" */
#define SEPARATE_SFASL_FILE "sfaslbfd.c"
Likewise, here is my rsym section in 386-linux.defs, (same as
powerpc-linux.defs):
ifeq ($(findstring libbfd,$(LIBS)),)
RSYM = rsym
endif
This definitely needs to be cleaned up, as configure could have put
libbfd in LIBS, but the user defines SPECIAL_RSYM in .h, so rsym
would be needed. Basically, its up to the user to sync their .defs
and .h should they choose overrides, and 386-linux.h is basically
not defining SPECIAL_RSYM unless libbfd is not found.
These are incremental changes to the build system meant to be
backwards compatible. When everyone is using the newer stuff, we
can make this more robust.
So basically for mingw, I think you can try the 386-linux entries
listed above, and see if bfd will relocate for you properly.
>
> What does rsym.exe do? (etc)
See above.
Take care,
>
> Cheers
>
> Mike Thomas.
>
>
>
>
>
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah