[Prev][Next][Index][Thread]

Re: Overriding stuff from OSKit libs, some random remarks, and patches



Michael Hohmuth wrote:
> One area where I did have trouble was convincing the linker that it
> should actually use stuff from my library and not from the OSKit's
> libraries.  For example, the linker liked to use osenv_irq_enable()
> from liboskit_dev and not from my lib even though my lib was first on
> the command line because this symbol was first used from within
> liboskit_dev.
[snip]
> There ought to be a better way.  How do you solve this problem?

Well, here's an idea:  perhaps all OSKit symbols should be declared
"weak" using __attribute__((weak));  From `info gcc`:

`weak'
     The `weak' attribute causes the declaration to be emitted as a weak
     symbol rather than a global.  This is primarily useful in defining
     library functions which can be overridden in user code, though it
     can also be used with non-function declarations.  Weak symbols are
     supported for ELF targets, and also for a.out targets when using
     the GNU assembler and linker.

As the OSKit's goal is to povide only the things you need, and to let
you do others, I think making all OSKit symbols weak would make sense.

This does require, though, that all of the OSKit headers are modified.
It's a pity that the OSKit doesn't use a prototyping macro like GNU's,
because then all of the symbol declarations could be changed using
one #define.

> A few other minor problems I stumbled over:
> 
> When building the OSKit by doing a "make" in the top-level directory,
> the make process sometimes aborts with a terse message similar to
> "make: Aborted".  Just restarting "make" finishes the build process.
> Any idea what's causing this?

Do you also get signal 11's from GCC ?

Ramon

Follow-Ups: References: