gcl-devel
[Top][All Lists]
Advanced

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

RE: [Gcl-devel] bfd coff back-end


From: Aurelien Chanudet
Subject: RE: [Gcl-devel] bfd coff back-end
Date: Mon, 12 Jan 2004 14:58:27 +0100

Hi Mike,

> I have both the GCL CVS version and the MinGW 2.14.90-20030807-1 source
> download from Sourceforge.  Below I am talking about the
> 2.14.90-20030807-1
> source

OK.

> This is where "reloc_entry->address" is added to "data" in the DOIT
> macro.

My line 144 says :

        unsigned char *addr = (unsigned char *) data + reloc_entry->address;

> Here is what I get on a small GCL object module.  Are you saying that
> the
> OFFSET column below is the value held in the r_vaddr field:

This is what I think, yes.

> ===============================================================
> $ objdump -r ./gazonk0.o
>
> ./gazonk0.o:     file format pe-i386
>
> RELOCATION RECORDS FOR [.text]:
> OFFSET   TYPE              VALUE
> 00000004 dir32             .data
> 00000009 DISP32            _do_init
> 00000018 dir32             _vs_limit
> 0000001e dir32             _vs_base
> 00000024 dir32             _vs_top
> 00000039 dir32             _vs_top
> 0000003e DISP32            _number_plus
> 0000004a dir32             _vs_top
> 0000004f dir32             _vs_base
> 0000005d DISP32            _vs_overflow
>
>
> RELOCATION RECORDS FOR [.data]:
> OFFSET   TYPE              VALUE
> 00000000 dir32             .text
>
>
> RELOCATION RECORDS FOR [.stab]:
> OFFSET   TYPE              VALUE
> 00000014 dir32             .text
> 00000020 dir32             .text
> 000007dc dir32             .text
> 00000800 dir32             .text
> 00000920 dir32             .data
> 0000092c dir32             .text
> ===============================================================

> At my line 5053 ?:
>
>       cache_ptr->address = dst.r_vaddr;

That's it.

> At my line 5088 ?:
>       cache_ptr->address -= asect->vma;

That's it.

> Putting s->vma = 0 just before that call gives a crash in the C runtime
> writing to a file, so I suppose there is a file index gone wrong
> somewhere
>
> For me this gives an error at line 714 of libbfd.c during:
>
>   bfd_seek (abfd, section->filepos + offset, SEEK_SET)
>
> the offset seems to be bad.

I haven't experimented anything of that sort.

This may be because I'm not exactly working on bfdtest.c itself.
The sample test file I'm using instead is hardly different, but is
more helpful in that it tries to execute the code, once relocated.

BFD sections have an output section field (s->output_section). What
we probably want to do is s->output_section->vma = 0 instead of
s->vma = 0. I'm just saying this for the sake of accuracy, because
in practice, s->output_section points to s.

> | I'll continue investigating this when I have time.
>
> Likewise - thanks
>
> Mike Thomas.

Talk soon,
Aurelien





reply via email to

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