l4-hurd
[Top][All Lists]
Advanced

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

Re: create_archive_ia32.pl (ddf)


From: Daniel Wagner
Subject: Re: create_archive_ia32.pl (ddf)
Date: Mon, 05 Jul 2004 21:59:08 +0200
User-agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Mon, 05 Jul 2004 11:11:28 -0400,
Etienne Robillard wrote:

> After that, matching the last line was only a matter of finding 
> an appropriate pattern like  ""elf32-i386")". I don't know if
> it's going to work with other systems, except maybe for Linux and FreeBSD.

Hmm, I don't know.  Let's wait and see if someone reports a problem.

I played a bit with the ld script and found out that something like this 
might work without the need to move around the binaries:

OUTPUT_FORMAT("elf32-i386", "elf32-i386",
              "elf32-i386")
OUTPUT_ARCH(i386)
page_size = 0x1000;

SEARCH_DIR("/home/wagi/src/hurd/fabrica/dplm");
TARGET("binary")

PHDRS
{
  headers PT_PHDR FILEHDR PHDRS;
  file_list PT_LOAD;
}

INPUT("dplm")

SECTIONS
{
  . = SIZEOF_HEADERS;

  dplm ALIGN(page_size): { "/home/wagi/src/hurd/fabrica/dplm/dplm" }

  foo ALIGN(page_size): { BYTE(1) }
  :file_list
}

This ld script results in:

address@hidden:~/src/hurd/fabrica/fabrica-archive$ objdump -x a.out

a.out:     file format elf32-i386
a.out
architecture: i386, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00000000

Program Header:
    PHDR off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000074 memsz 0x00000074 flags r--
    LOAD off    0x00001000 vaddr 0x00001000 paddr 0x00001000 align 2**12
         filesz 0x0000b001 memsz 0x0000b001 flags rw-

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 dplm          0000adad  00001000  00001000  00001000  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  1 foo           00000001  0000c000  0000c000  0000c000  2**0
                  CONTENTS, ALLOC, LOAD, DATA
SYMBOL TABLE:
00001000 l    d  dplm   00000000
0000c000 l    d  foo    00000000
00000000 l    d  *ABS*  00000000
00000000 l    d  *ABS*  00000000
00000000 l    d  *ABS*  00000000
00001000 g       dplm   00000000 
_binary__home_wagi_src_hurd_fabrica_dplm_dplm_start
0000adad g       *ABS*  00000000 
_binary__home_wagi_src_hurd_fabrica_dplm_dplm_size
0000bdad g       dplm   00000000 
_binary__home_wagi_src_hurd_fabrica_dplm_dplm_end
00001000 g       *ABS*  00000000 page_size


As you can see the SEARCH_DIR has to point to the dir where the
binaries are.  A glitch is that the path is coded into the label of
globals.  Well, I don't think that's a real problem.

I have check in your patch with a small modification. I changed the line
where ENTRY and SEARCH_DIR is printed into the ld-script file because this
is not working yet.

Anyway, thanks.

cheers,
daniel




reply via email to

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