[PATCH] D29637: [LLD][ELF] Use synthetic section to hold copy relocations

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 04:02:58 PST 2017


peter.smith updated this revision to Diff 87627.
peter.smith added a comment.

Thank you very much for the comments. I've updated the diff to make the requested changes.

I've also had a quick investigate into how many copy relocs we would expect to see. I ran readelf --relocs | grep _COPY over most of the executables on my Linux box and came back with most having 0, quite a few having < 10 and a few outliers with 60 to 70. These were gdb and  gpartedbin.

I would prefer to keep one section per copy rel as we can assume the offset in the section is 0, otherwise we'll need to record the offset in SharedSymbol.

| number of copy rels | number of executables |
| 0                   | 4159                  |
| 1                   | 515                   |
| 2                   | 471                   |
| 3                   | 343                   |
| 4                   | 308                   |
| 5                   | 277                   |
| 6                   | 239                   |
| 7                   | 93                    |
| 8                   | 9                     |
| 9                   | 25                    |
| 10                  | 7                     |
| 11                  | 12                    |
| 12                  | 10                    |
| 13                  | 13                    |
| 14                  | 11                    |
| 15                  | 4                     |
| 16                  | 3                     |
| 17                  | 6                     |
| 18                  | 1                     |
| 19                  | 3                     |
| 20                  | 2                     |
| 21                  | 1                     |
| 22                  | 4                     |
| 26                  | 4                     |
| 35                  | 4                     |
| 36                  | 3                     |
| 66                  | 1                     |
| 76                  | 1                     |


https://reviews.llvm.org/D29637

Files:
  ELF/Relocations.cpp
  ELF/Symbols.cpp
  ELF/Symbols.h
  ELF/SyntheticSections.cpp
  ELF/SyntheticSections.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29637.87627.patch
Type: text/x-patch
Size: 6936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170208/ea83b465/attachment.bin>


More information about the llvm-commits mailing list