[PATCH] D38238: [ELF] Add constant for querying the image base in linker scripts

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 15:31:01 PDT 2017


jhenderson added a comment.

In https://reviews.llvm.org/D38238#880313, @ruiu wrote:

> OK, so the current behavior of -image-base is that it doesn't have any effect if a linker script is used, is this correct. I can imagine that that is perceived as a pretty odd behavior from the user's perspective. I think a natural assumption of the -image-base behavior to start . with an address given by -image-base.
>
> We don't need to think about backward compatibility because -image-base is a new option, no?


Assuming I use Config->ImageBase (which would seem natural), to set the initial value of ., this will affect the behaviour of links even without the use of -image-base, as the value is non-zero for most targets by default. For example, a single linker script that looks like the following for x86_64 would produce a different value for "mysym" (0 previously, 0x200000 with that change):

  SECTIONS {
    mysym = .;
  }


https://reviews.llvm.org/D38238





More information about the llvm-commits mailing list