[lld] r190608 - [lld][LayoutPass] Order the atoms that are in the same chain
Nick Kledzik
kledzik at apple.com
Fri Sep 13 16:56:28 PDT 2013
On Sep 13, 2013, at 4:40 PM, Rui Ueyama <ruiu at google.com> wrote:
> I know we are using SimpleFile for GOT/PLT atoms, for example, and I doubt that's a good design. These atoms are not read from any files but produced by the linker after the core liking is done so semantically they don't belong to any file. A SimpleFile is used only as a dummy value because it's mandatory. We might be able to simplify the thing by making an optional thing optional.
>
> So I'd want to make _file field optional for the atom. What do you guys
> think?
> I dont think we do this.
>
> Can you elaborate?
>
In the darwin linker (also atom based), the file() method is optional. And that has been a big source of (crasher) bugs. Because to be truly optional, every place in the linker that access the file() method must be prepared for it to return NULL and do something. That is a pain to get right.
Having a dummy file with some useful name (e.g. “GOT pass”) simplifies all clients (don’t need to check if file exists), and makes error messages more useful.
-Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130913/088979d6/attachment.html>
More information about the llvm-commits
mailing list