[PATCH] D18499: [ELF] - Implemented prototype of location counter support.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 27 07:16:44 PDT 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
Herald added a subscriber: emaste.

This patch implements my ideas about possible location counter support (very initial now, but few features are already working, output is equal with gold output for testcase and these ideas can be extended I believe). Patch is not ready to submit. It does not contains testcases for errors, probably something else, so it is a demo prototype.

Main testcase I want to show is test/ELF/linkerscript-locationcounter.s, It contains some work with location counter taken from freebsd sample (https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup). It is basic now.
Implemented location counter assignment and ALIGN operations.

Approach is pretty straightforward: each output section now has a list of tokens (expressions list). Later during assigning section addresses this expressions are parsed, Reverse Polish Notation is generated and used to calculate the final VA value for output section. 

That should be extremely fast. Complexity of all that operations is O(n) I think.

http://reviews.llvm.org/D18499

Files:
  ELF/LinkerScript.cpp
  ELF/LinkerScript.h
  ELF/Target.cpp
  ELF/Writer.cpp
  test/ELF/end.s
  test/ELF/linkerscript-locationcounter.s
  test/ELF/linkerscript-oneload.s
  test/ELF/linkerscript-sections-keep.s
  test/ELF/linkerscript-sections-padding.s
  test/ELF/wildcards.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18499.51734.patch
Type: text/x-patch
Size: 28046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160327/cbca927e/attachment.bin>


More information about the llvm-commits mailing list