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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 09:21:27 PDT 2017


grimar created this revision.

This is PR32664. Current LLD behavior - segfault.

I found 2 ways of solving the issue.
One of them is this patch, second is <DXXXXXX, will update this placeholder in a minute>.

Problem itself is next. Imagine next script and code:
SECTIONS { . = 0x1000;  aaa = ABSOLUTE(foo - 1); .text : { *(.text*) } };

.section .text
.globl foo
foo:
nop

At the moment of assignment to aaa we do not know the address of output section .text.
We are unable to evaluate the absolute value aaa properly therefore.

This patch suggests to handle forced absolute symbols like regular symbols until we assign
all output sections addresses. After that it converts them into absolute.


https://reviews.llvm.org/D32173

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: D32173.95588.patch
Type: text/x-patch
Size: 5103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170418/fc880f36/attachment.bin>


More information about the llvm-commits mailing list