This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Regression on prelinked-sepdebug-shlibs


On Jan 7, 2010, at 2:42 PM, Daniel Jacobowitz wrote:

> On Thu, Jan 07, 2010 at 12:03:04PM +0100, Tristan Gingold wrote:
>> I am not sure that you can create a linux native executable with a section whose vma is 0.
> 
> I'm pretty sure you can't.  The program headers are going to be at the
> start of the executable, before any section.  So I'm not entirely sure
> what kind of executable you get from doing this :-)

You lost me.  They can be on different pages ?

In fact I can build such a statically linked program.  However it looks like ld.so or libc doesn't like
such a program (also it is buildable).

$ cat sep.c
int zero (void) __attribute__((section("sec_zero")));
int zero (void)
{
  return 12;
}

void _start (void)
{
  asm volatile ("int $0x80" : : "a"(1), "b"(zero()));
}

$ gcc -c -g -m32 sep.c
$ gcc -m32 -o sep sep.o -Wl,--section-start,sec_zero=0 -nostdlib
$ readelf -S sep
There are 14 section headers, starting at offset 0x136c:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] sec_zero          PROGBITS        00000000 001000 00000a 00  AX  0   0  1
  [ 2] .text             PROGBITS        08048094 001094 000015 00  AX  0   0  4
  [ 3] .comment          PROGBITS        00000000 0010a9 00002e 00      0   0  1
  [ 4] .debug_aranges    PROGBITS        00000000 0010d7 000028 00      0   0  1
  [ 5] .debug_pubnames   PROGBITS        00000000 0010ff 000026 00      0   0  1
  [ 6] .debug_info       PROGBITS        00000000 001125 00008c 00      0   0  1
  [ 7] .debug_abbrev     PROGBITS        00000000 0011b1 000047 00      0   0  1
  [ 8] .debug_line       PROGBITS        00000000 0011f8 000044 00      0   0  1
  [ 9] .debug_frame      PROGBITS        00000000 00123c 000048 00      0   0  4
  [10] .debug_loc        PROGBITS        00000000 001284 000058 00      0   0  1
  [11] .shstrtab         STRTAB          00000000 0012dc 000090 00      0   0  1
  [12] .symtab           SYMTAB          00000000 00159c 000110 10     13  12  4
  [13] .strtab           STRTAB          00000000 0016ac 00002b 00      0   0  1

Tristan.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]