[PATCH] D45434: [ELF] - Eliminate AssertCommand.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 9 04:27:44 PDT 2018
grimar created this revision.
grimar added reviewers: ruiu, espindola.
Herald added subscribers: arichardson, emaste.
Currently, LLD supports ASSERT as a separate command.
We support two forms now.
1. Assign expression-view: `. = ASSERT(0x100)`
(old GNU ld required it and some scripts in the wild are still using
something like `. = ASSERT((_end - _text <= (512 * 1024 * 1024)), "kernel image bigger than KERNEL_IMAGE_SIZE");`
2. Nowadays above is not a mandatory form and command-like form is commonly used:
`ASSERT(<expr>, "text);`
The return value of the `ASSERT` is Dot. That was implemented in https://reviews.llvm.org/D30171.
It looks like (2) is just a short version of (1) then.
GNU ld does *not* list ASSERT as a SECTIONS command:
https://sourceware.org/binutils/docs/ld/SECTIONS.html#SECTIONS
Given above I think we can change ASSERT to be an assignment to Dot.
That makes the rest of the code much simpler.
https://reviews.llvm.org/D45434
Files:
ELF/LinkerScript.cpp
ELF/LinkerScript.h
ELF/ScriptParser.cpp
test/ELF/linkerscript/assert.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45434.141614.patch
Type: text/x-patch
Size: 4928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180409/90e3358a/attachment-0001.bin>
More information about the llvm-commits
mailing list