grub-devel
[Top][All Lists]
Advanced

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

Re: Compiling grub2 on *BSD?


From: walt
Subject: Re: Compiling grub2 on *BSD?
Date: Wed, 30 Jan 2008 11:06:50 -0800

On Wed, 2008-01-30 at 08:38 -0800, walt wrote:
> Robert Millan wrote:
> ...

> > What happens if you define the missing symbols somewhere?  Any part of
> > the GRUB kernel will do (e.g. kern/main.c).  Just add them as empty
> > functions:
> >
> > void
> > __sysctl (void)
> > {
> > }
> >
> > void
> > mprotect (void)
> > {
> > }
> >
> > and check if that works.

> Anyway, your suggestion helps, but not quite enough.  The c code now
> compiles and links okay into *.mod files, but now __enable_execute_stack
> shows up in several und-*.lst files...

I've been hacking the various flags for elf.mod just to get *any* module
to link properly but no luck.  Here is the actual text printed by gcc 
as it links elf.mod:

gcc -m32 -nostdlib -lgcc -L/usr/lib  -Wl,-r,-d,-lgcc,-L/usr/lib -o
elf.mod pre-elf.o mod-elf.o

You can tell I'm desperate because I'm putting -lgcc everywhere I can
think of.  Here is the symbol in libgcc.a:

_enable_execute_stack.o:
00000000 T __enable_execute_stack

And here is the symbol table from the resulting elf.mod:

# nm elf.mod 
         U __enable_execute_stack   <======= WTF?
0000038a T grub_elf32_load
000003fe T grub_elf32_size

Okay, I found one *more* place to put libgcc:

gcc -m32 -nostdlib -lgcc -L/usr/lib  -Wl,-r,-d,-lgcc,-L/usr/lib -o
elf.mod pre-elf.o mod-elf.o /usr/lib/libgcc.a

Here is the puzzling (to me) result:

# nm elf.mod 
00000784 T __enable_execute_stack
         U __sysctl
0000038a T grub_elf32_load
000003fe T grub_elf32_size







reply via email to

[Prev in Thread] Current Thread [Next in Thread]