[PATCH] D32173: [ELF] - Assign absolute values in linkerscript correctly #1.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 05:41:32 PDT 2017


grimar added a comment.

In https://reviews.llvm.org/D32173#730327, @ruiu wrote:

> Is your example linker script valid for GNU linkers? I'm curious why you noticed this in the first place.


I noticed that when tried to link linux kernel. It has next script at start:

  SECTIONS
  {
   . = (0xffffffff80000000 + ALIGN(0x1000000, 0x200000));
   phys_startup_64 = ABSOLUTE(startup_64 - 0xffffffff80000000);
   /* Text and read-only data */
   .text : AT(ADDR(.text) - 0xffffffff80000000) {
  .....
    /* bootstrapping code */
    *(.head.text)

Where startup_64 is in .head.text. Currently we segfault, but even with change at LinkerScript.cpp::75 which fixes crash we do
produce wrong symbol value for phys_startup_64. 
(we produce 0 - 0xffffffff80000000 == 0x0000000080000000 instead of 0xffffffff81000000 - 0xffffffff80000000 == 0x0000000001000000).

And this patch fixes that I believe.


https://reviews.llvm.org/D32173





More information about the llvm-commits mailing list