This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: LMA and file offsets in gold


What you're observing may be a bug:

   https://sourceware.org/bugzilla/show_bug.cgi?id=20280

A patch has been proposed here, which I'm reviewing:

   https://sourceware.org/ml/binutils/2016-10/msg00161.html

-cary


-cary

On Wed, Sep 21, 2016 at 12:23 PM, Eugene Leviant
<evgeny.leviant@gmail.com> wrote:
> I'm wondering what algorithm is used by gold when assigning file
> offsets for sections in ELF image. At a very first glance it looks
> like following:
>
> - Normally file offset in equal to LMA modulo page size (unless
> section has AT specifier LMA is equal to VMA).
>
> - Things change when two or more sections with non-zero LMA offset
> share the same PT_LOAD. This can be achieved using the following
> linker script:
>
> PHDRS {
>   all PT_LOAD;
> }
>
> SECTIONS {
>   .foo 0x800000 : AT(0) { *(.foo) } : all
>   .bar 0x900000 ; { *(,bar) } : all
> }
>
> In such case file offset of output section .bar is file offset of .foo
> + (0x900000 - 0x800000).
> Does anyone know how exactly those offsets are computed ?


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