Hi,
I got some question about the AT directive in linker script. I have
post this question to binutils{at}sourceware.org with no reply.
Hopefully someone can help me out.

After some searching and asking, I finally know that the AT directive
tell the linker about LMA of  a section.

For example there is some linker script like this:

    SECTIONS
    {
        . = 0X80100000;
        .text : AT(0x100000) {
            *(.text .stub .text.* .gnu.linkonce.t.*)
        }

      ... blah blah ...
    }

Now 0x8010000 is a VMA, and 0x100000 is a LMA.

My question is, is LMA the same as the physical address in a ELF
program header ? A typical ELF declaration would be something like
this:

typedef struct
{
  Elf32_Word    p_type;                 /* Segment type */
  Elf32_Off     p_offset;               /* Segment file offset */
  Elf32_Addr    p_vaddr;                /* Segment virtual address */
  Elf32_Addr    p_paddr;                /* Segment physical address */
  Elf32_Word    p_filesz;               /* Segment size in file */
  Elf32_Word    p_memsz;                /* Segment size in memory */
  Elf32_Word    p_flags;                /* Segment flags */
  Elf32_Word    p_align;                /* Segment alignment */
} Elf32_Phdr;

Is LMA just **p_paddr** in the program header?

My understanding is, when the linker link all the object files
together and then output a executable file of ELF format, those LMA
declare in the linker script would be the **p_paddr** in the
executable file, so the loader can correspondingly put that program on
the physical address as declared by **p_paddr**. Is that correct?
Please correct me if you may. I'm reading some low level code and is
not really familiar with those low level stuff.

Thanks in advance!
Ruan.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to