Ben:
[Please send these to eros-port so that everyone can see them]
I have several levels of reaction to this.
First, the conflicting definitions in protospace.S should be deleted in favor of the ones in i486/eros/asm.h. The ones in protospace.S are vestigial. I will take this change up as soon as I'm done digging through the present stack of email.
That aside, I'm leery of trying to resolve this. My recollection is that this is one of the differences between the ELF tool chain and the a.out tool chain. BSD as, for some reason, used powers of two in .align directives.
Fixing this, either through a mechanism like what you propose or by using a suitable version of the compilation tools, is relatively straightforward. It will help if you might send me the stderr output from the gcc invocation to assemble any convenient .S file; I'll look at the environment-supplied defines and sensitize eros/asm.h to the compilation environment.
I am concerned, however, that you are climbing down a relatively deep rathole. There are a number of dependencies in various low-level parts of the kernel that presently rely on use of the ELF object file format. Perhaps you can educate me, but my recollection is that FreeBSD will *run* ELF, but does not generate ELF from its compilers. If you wish to take a look at it, you'll want to look at
cross/lib/erosimg/ExecImageAout.cxx
and also at the low-level assumptions in the boot code makefile and the transfer from bootcode into the kernel. Finally, note that some sleazy tricks are being played in the kernel to make the global constructors come out right, and the current solution is ELF dependent. Making this work for a.out will require some effort. At least the kernel debugger will be relatively immune, because it doesn't actually know anything about the object file format. Doing all this compatibly is tricky.
The good news is that it *used* to be built this way (circa 1992), so I know it can be done.
Another option is to build a cross-tool chain that generates ELF. Configuring GCC to generate i386-unknown-linux might work.
I'm happy to incorporate/review changes to accomodate the a.out thing, but there are some bugs that need to get fixed in the next month or two before I go off the air on code changes, and these are higher priority.
Finally, note that I don't have access to a FreeBSD machine. If it's possible to provide a login on your machine I can pop over see what I can do...
Jonathan
Ben Laurie <ben@algroup.co.uk> on 12/25/98 03:02:23 PM
To: Jonathan S Shapiro/Watson/IBM
cc:
Subject: Alignment
Seems my compiler does .aligns in assembler in powers of two (i.e. to get 16-byte aligns, I do .align 4 and you do .align 16). So my thought was to create a bunch of defines like so:
#ifdef ALIGN_POW
# define ALIGN2 1
# define ALIGN4 2
# define ALIGN8 3
# define ALIGN16 4
#else
# define ALIGN2 2
# define ALIGN4 4
# define ALIGN8 8
# define ALIGN16 16
#endif
in some header. A natural choice seemed, at first, to be base/sys/arch/i468/eros/asm.h, but it has defintions that conflict with other assembler files - e.g. base/domain/constructor/i486/protospace.S. I think these conflicts are a bad thing, but I don't want to embark on resolving them without getting your view first!
So ... what do we do?
Cheers,
Ben.
-- Ben Laurie |Phone: +44 (181) 735 0686| Apache Group member Freelance Consultant |Fax: +44 (181) 735 0689|http://www.apache.org/ and Technical Director|Email: ben@algroup.co.uk | A.L. Digital Ltd, |Apache-SSL author http://www.apache-ssl.org/ London, England. |"Apache: TDG" http://www.ora.com/catalog/apache/