OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 2:23 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Section LMA overlap
PostPosted: Sun May 27, 2018 1:11 pm 
Offline
User avatar

Joined: Thu Apr 20, 2017 7:45 am
Posts: 5
Hey everybody!

I am trying to develop a kernel. I use advanced linker scripting, because I want it to be debuggable both before and after higher half switch. Thus, I use the AT() parameter extensibly. However, I am getting a strange linker error:

Code:
/home/jakub/.local/stow/i686-elf-toolchain/lib/gcc/i686-elf/9.0.0/../../../../i686-elf/bin/ld: section .rodata LMA [ffffffff40000000,ffffffff40000017] overlaps section .text LMA [ffffffff40000000,ffffffff4000004d]


The full linker script is:

Code:
ENTRY (_start);

SECTIONS
{
  . = 0x00100000;

  PROVIDE (_begin = .);

  .text.early BLOCK (4K) : ALIGN (4K)
  {
    *(.text.early);
  }

  . += 0xC0000000;

  .text BLOCK (4K) : AT (. - 0xC0000000) ALIGN (4K)
  {
    *(.text);
  }

  .rodata BLOCK (4K) : AT (. - 0xC0000000) ALIGN (4K)
  {
    *(.rodata);
  }

  .data BLOCK (4K) : AT (. - 0xC0000000) ALIGN (4K)
  {
    *(.data);

    . = ALIGN (4K);
  }

  PROVIDE (_edata = .);

  .bss BLOCK (4K) : AT (. - 0xC0000000) ALIGN (4K)
  {
    *(COMMON);
    *(.bss);

    /*
     * PABSS is Page Aligned BSS.
     *
     * Everything in PABSS has to be aligned to 4K.
     */
    . = ALIGN (4K);
    *(.pabss);

    . = ALIGN (4K);
  }

  PROVIDE (_end = .);
}


Am I missing something or is this a bug?

Thanks in advance!

_________________
There be dragons: https://jakub.kaszycki.net.pl/en/


Top
 Profile  
 
 Post subject: Re: Section LMA overlap
PostPosted: Sun May 27, 2018 1:35 pm 
Offline
User avatar

Joined: Thu Apr 20, 2017 7:45 am
Posts: 5
OK, I figured it out by myself.

The section should look like:

Code:
.somesection BLOCK (4K) : AT (ADDR (.somesection) - 0xC0000000) ALIGN (4K)

_________________
There be dragons: https://jakub.kaszycki.net.pl/en/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 100 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group