[PATCH] [lld] Define DefinedAtom::sectionSize.

Rui Ueyama ruiu at google.com
Fri Feb 27 17:20:18 PST 2015


Merge::mergeByLargestSection is half-baked since it's defined
in terms of section size, there's no way to get the section size
of an atom.

Currently we work around the issue by traversing the layout edges
to both directions and calculate the sum of all atoms reachable.
I wrote that code but I knew it's hacky. It's even not guaranteed
to work. If you add layout edges before the core linking, it
miscalculates a size.

Also it's of course slow. It's basically a linked list traversal.

In this patch I added DefinedAtom::sectionSize so that we can use
that for mergeByLargestSection. I'm not very happy to add a new
field to DefinedAtom base class, but I think it's legitimate since
mergeByLargestSection is defined for section size, and the section
size is currently just missing.

http://reviews.llvm.org/D7966

Files:
  include/lld/Core/DefinedAtom.h
  lib/Core/SymbolTable.cpp
  lib/ReaderWriter/PECOFF/Atoms.h
  lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
  test/pecoff/Inputs/merge-same-size3.obj.yaml

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7966.20919.patch
Type: text/x-patch
Size: 9308 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150228/8bdaeef5/attachment.bin>


More information about the llvm-commits mailing list