RE: [Tuxnes-devel] Trying to build on OpenBSD 2.9
Brought to you by:
tmmm
|
From: Ben S. <BSi...@Kn...> - 2001-08-23 21:37:18
|
Here's the (long-winded) story:
Most non-ELF C compilers prefix external identifier names with an underscore
("_")
when generating assembly or machine code. This tradition dates back at least
to the
PDP-11 tools, and quite possibly earlier (I'm no historian, but the original
"a.out"
object file format did this.) As a result, many object file tools (gdb, nm,
objtool,
etc.) have ugly heuristics to convert the _-prefixed identifiers into
human-readable
identifiers (as seen in the C source.) This is a completely useless bit of
overhead,
now that nobody uses FORTRAN, COBOL or Pascal compilers very much. [In the
old days
FORTRAN was the default language, and C was the latecomer which bit off a
small un-
used part fo the FORTRAN identifier namespace.]
Most ELF C compilers, on the other hand, leave identifiers unchanged, and so
the rest
of the toolchain can Keep It Simple, and display identifiers exactly as they
appear in
object files. These days FORTRAN is the second-class citizen which must use
special
namespace protection :)
Keep in mind that Linux used to use an a.out object file format, and most
Linux
development migrated from a.out to ELF a few years ago. TuxNES is written in
the
ELF style, but with carefully-chosen names to make a.out support easy (I'm
not
sure, but I think NEStra may have been developed originally on an a.out
Linux
system.)
Anyhow, my guess is that OpenBSD is using a non-ELF object file format (the
'file'
command will tell you for sure) and so the C identifier LASTBLANK *is* the
asm
label _LASTBLANK. When you #define LASTBLANK to _LASTBLANK, the C identifier
becomes
_LASTBLANK, which is the asm label __LASTBLANK.
There is a way to do this portably, I believe: declare _LASTBLANK with the
"asm"
type qualifier in C, like so:
extern asm int _LASTBLANK; /* or whatever the C declaration looks like, +
asm */
Also retain the #define LASTBLANK _LASTBLANK, or fix the C files to use
_LASTBLANK.
The asm type qualifier should prevent an a.out C compiler from prefixing the
'_',
and ELF C compilers should ignore it.
Let me know whether that works :)
-ben
P.S. sorry to be so completely unresponsive for the last year (!), I've been
busy with
a new job.
-----Original Message-----
From: Mike Melanson [mailto:mel...@pc...]
Sent: Thursday, August 23, 2001 11:17 AM
To: 'tux...@li...'
Subject: RE: [Tuxnes-devel] Trying to build on OpenBSD 2.9
On Thu, 23 Aug 2001, HUYNH,SONTRI (HP-Richardson,ex1) wrote:
> Actually.. (sorry, this email is following my train of actions) I just
> commented out
> the #include lines of x86.S and it builds fine. In fact, I only have to
> comment out
> "#define _LASTBANK LASTBANK /* Last memory page code executed in */"
> from
> mapper.h.
>
> Does this make sense to anyone?
Nope, but if it works, great. It also doesn't make sense that
LASTBANK doesn't actually seem to be used (assigned) anywhere in the code
(try 'grep LASTBANK *' in the source dir). I'm still puzzling over that
one. Can you certify TuxNES as working on OpenBSD/i386 if that line in
mapper.h is gone? If so, I'll note that fact on the features page.
-Mike Melanson
_______________________________________________
Tuxnes-devel mailing list
Tux...@li...
http://lists.sourceforge.net/lists/listinfo/tuxnes-devel
|