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

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 07:21:04 PST 2017


Peter Smith via Phabricator <reviews at reviews.llvm.org> writes:

> 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.

Agreed, with so few sections there is no point in optimizing.

> Index: ELF/SyntheticSections.h
> ===================================================================
> --- ELF/SyntheticSections.h
> +++ ELF/SyntheticSections.h
> @@ -107,6 +107,18 @@
>    uint8_t *HashBuf;
>  };
>  
> +// BSS section created for a copyReloc

s/BSS/NOBITS/


LGTM with that.

Cheers,
Rafael


More information about the llvm-commits mailing list