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 6, 2010, at 8:16 PM, Daniel Jacobowitz wrote:

> On Wed, Jan 06, 2010 at 07:05:10PM +0100, Jan Kratochvil wrote:
>> On Wed, 06 Jan 2010 17:38:55 +0100, Tristan Gingold wrote:
>>> I think this is not correct: the separate debug file may have one section at
>>> zero while the main may not.  In the above code, we do not consider wether
>>> an offset is used.
>>> 
>>> I am not sure that this can happen with ELF however.
> 
> Sorry, I don't quite understand this.

I am not sure that you can create a linux native executable with a section whose vma is 0.

I tried this:
$ cat sep.c
#include <stdio.h>

int zero (void) __attribute__((section("sec_zero")));
int zero (void)
{
  return 0;
}

int main (void)
{
  printf ("Zero=%d\n", zero ());
  return 0;
}

$ gcc -c -g sep.c
$ gcc -o sep sep.o -Wl,--section-start,sec_zero=0

But unfortunately linux refuses to execute that (I got a sigkill very very early) so I can't play with that.
(and I haven't investigated further in the kernel ;-)

>> This has_section_at_zero feature is intended for embedded targets.  I only
>> know has_section_at_zero can never happen for cases I am aware of.
>> 
>> IMHO embedded targets do not use the file-vs-memory offsets but not sure.
>> Also the embedded targets probably do not use .linkonce/COMDAT - this is why
>> this has_section_at_zero differentiator could work.
> 
> An embedded program can use either of these things.  The
> linkonce/comdat issue is a constant problem, but this was the best
> available heuristic.

I agree that this heuristic make sense.  However I don't think that the one used for separate debug objfile
is correct.  I will submit a patch to discuss this point.

Tristan.


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