[PATCH] D32793: [ELF] - Don't segfault when assigning non-calculatable absolute symbol value.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 04:07:27 PDT 2017


grimar created this revision.

This is PR32664.

Issue was revealed by linux kernel script which was:

  SECTIONS {
   . = (0xffffffff80000000 + ALIGN(0x1000000, 0x200000));
   phys_startup_64 = ABSOLUTE(startup_64 - 0xffffffff80000000);
  
   .text : AT(ADDR(.text) - 0xffffffff80000000) {
  .....
    *(.head.text)

Where startup_64 is in .head.text.

At the place of assignment to phys_startup_64 we can not calculate absolute value for startup_64
because .text section has no VA assigned. Two patches were prepared earlier to address this: https://reviews.llvm.org/D32173 and https://reviews.llvm.org/D32174.

And in comments for https://reviews.llvm.org/D32173 was suggested not try to support this case, but error out. That is what patch do.
For doing that it introduces CanCalculateAbs flag member of Expr, which is used to determine if absolute value
of expression is calculatable.


https://reviews.llvm.org/D32793

Files:
  ELF/LinkerScript.cpp
  ELF/LinkerScript.h
  ELF/ScriptParser.cpp
  test/ELF/linkerscript/early-assign-symbol.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32793.97591.patch
Type: text/x-patch
Size: 5377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170503/19d63866/attachment.bin>


More information about the llvm-commits mailing list