bug-grub
[Top][All Lists]
Advanced

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

Elf headers/symbols?


From: Adrian Chadd
Subject: Elf headers/symbols?
Date: Sat, 4 Aug 2001 06:09:38 -0400
User-agent: Mutt/1.2.5i

Hi all,

I'm working on a project (xmach) that uses a multiboot boot loader
(ie grub) to boot.

The xmach kernel is an ELF kernel.

I'm currently trying to bring in elf symbol support into the ddb.
This means I need to locate the symbol/string table(s).

The GRUB-CVS codebase supports loading in the ELF section headers,
but I can't find anywhere where the Elf_Ehdr is actually loaded
in and passed to the booted program.

>From what I've found out (by reading documentation and code) you need
the Elf_Ehdr to determine which Elf section is actually the main
string table. There could be more than one string table (and in
xMach's case, there is:

address@hidden:~/work/xmach/cvs/src/sys/mach/generic/kernel/ddb> readelf -S 
/xMach/boot/kernel
There are 10 section headers, starting at offset 0x8857c:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00       0   0 0
  [ 1] .text             PROGBITS        00100000 000080 06a01a 00  AX   0   0 4
  [ 2] .rodata           PROGBITS        0016a020 06a0a0 01361a 00   A   0   0 
32
  [ 3] .data             PROGBITS        0017e640 07d6c0 007318 00  WA   0   0 
32
  [ 4] .bss              NOBITS          00185960 0849e0 01d3b0 00  WA   0   0 
32
  [ 5] .comment          PROGBITS        00000000 0849e0 002a62 00       0   0 1
  [ 6] .note             NOTE            00000000 087442 0010f4 00       0   0 1
  [ 7] .shstrtab         STRTAB          00000000 088536 000043 00       0   0 1
  [ 8] .symtab           SYMTAB          00000000 08870c 010c20 10       9 5cc 4
  [ 9] .strtab           STRTAB          00000000 09932c 00f493 00       0   0 1
Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings)
              I (info), L (link order), O (extra OS processing required)
              o (os specific), p (processor specific) x (unknown)

Before you say "just use the name!" the name is actually an index into
the .shstrtab referenced by ehdr->e_shstrndx . And I don't have ehdr. :)

Has anyone used GRUB (and multiboot in general) to load an ELF kernel 
along with a symbol table? I'd like some feedback on this.

Thanks!



Adrian




reply via email to

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