[PATCH] D40026: [ELF] - Allow applying SHF_MERGE optimization for relocatable output.
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 08:37:07 PST 2017
George Rimar via Phabricator <reviews at reviews.llvm.org> writes:
> grimar updated this revision to Diff 123158.
> grimar added a comment.
>
> - Rebased. Most of changes were gone away.
>
>
> https://reviews.llvm.org/D40026
>
> Files:
> ELF/InputFiles.cpp
> ELF/LinkerScript.cpp
> ELF/Writer.cpp
> test/ELF/merge-reloc.s
>
>
> Index: test/ELF/merge-reloc.s
> ===================================================================
> --- test/ELF/merge-reloc.s
> +++ test/ELF/merge-reloc.s
> @@ -3,10 +3,9 @@
> # RUN: ld.lld %t.o -r -o %t-rel
> # RUN: llvm-readobj -s -section-data %t-rel | FileCheck %s
>
> -# When linker generates a relocatable object it should keep "merge"
> -# sections as-is: do not merge content, do not join regular and
> -# "merge" sections, do not joint "merge" sections with different
> -# entry size.
> +# When linker generates a relocatable object it do string merging in the same
it does
> - // When control reaches here, mergeable sections have already been
> - // merged except the -r case. If that's the case, we do not combine them
> - // and let final link to handle this optimization.
> + // When control reaches here, mergeable sections have already been merged.
> + // For relocatable case each input mergeable section contains data grouped by
> + // sh_entsize and we want to allow final link to perform the last merging
> + // optimization, so we emit unique output section for each input.
> if (Config->Relocatable && (IS->Flags & SHF_MERGE))
> return createSection(IS, OutsecName);
In all cases the input sections contain data grouped by sh_entsize. I
think the comment can be just
// When control reaches here, mergeable sections have already been
// merged into synthetic sections.
// For relocatable case we want to create one output section per
// syntetic section so that they have a valid sh_entsize.
LGTM with that.
Thanks,
Rafael
More information about the llvm-commits
mailing list