bug-glibc
[Top][All Lists]
Advanced

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

User defined sections


From: Daniël Mantione
Subject: User defined sections
Date: Wed, 10 Oct 2001 15:15:07 +0200 (CEST)

Hello,

I'm trying to create a program with a custom section. This doesn't seem to
work; ld.so crashes on it.

I have generated my custom section with Nasm:

[SECTION .custom exec write alloc]

some_data:      db 'This is some data...'


Then I have modified the default linker script to load it at the fixed
address 0 (other fixed addresses also cause problems). Here are the first
lines:

SECTIONS
{
  . = 0;
  .custom      : { *(.custom) }
  /* Read-only sections, merged into text segment: */
  . = 0x20000000 + SIZEOF_HEADERS;
  .interp     : { *(.interp)    }
  .hash          : { *(.hash)           }
  .dynsym        : { *(.dynsym)         }
  .dynstr        : { *(.dynstr)         }
  .gnu.version   : { *(.gnu.version)    }


Then a small test program:

#include <stdlib.h>
#include <stdio.h>

int main() {
    printf("If this appears on the screen there is no problem.\n");
};

And a makefile:

problem: problem.o image.o
        gcc -Xlinker -T -Xlinker link.res -o problem problem.o image.o

problem.o: problem.c
        gcc -c -o problem.o problem.c

image.o:
        nasm -f elf -o image.o image.asm


Why doesn't this work? Am I doing something wrong or is this a bug in
ld.so?

I have placed these files on the web at
http://darkstar.vhl.tudelft.nl/customsection

Greetings,

Daniël Mantione





reply via email to

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