[PATCH] D23924: [ELF] - Linkerscript: allow add MergeInputSection to regular OutputSection.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 08:29:52 PDT 2016


grimar created this revision.
grimar added reviewers: rafael, ruiu.
grimar added subscribers: llvm-commits, grimar, davide, evgeny777, emaste.

[ELF] - Linkerscript: allow to add MergeInputSection to regular OutputSection.

Before this patch SHF_MERGE sections were always proccessed as regular
ones when script layouting was used. 

That was done because we create single output section
for each list of inputsections when have SECTIONS command. Since there was
no way to handle the case when there were mixed section types in that list 
(mergeable vs non-mergeable), functionality was temporarily disabled.

This is the case that can be observed in FreeBSD, which has a mix of attributes
for .rodata:
> [ 6] .rodata           PROGBITS         ffffffff80c87c8c  00c86c8c
>      00000000000e6e4d  0000000000000001 AMS       0     0     1
> [ 7] .rodata           PROGBITS         ffffffff80d6eae0  00d6dae0
>      0000000000246f00  0000000000000000   A       0     0     32
> [ 8] .rodata           PROGBITS         ffffffff80fb59e0  00fb49e0
>      00000000000001f0  0000000000000010  AM       0     0     16
> [ 9] .rodata           PROGBITS         ffffffff80fb5bd0  00fb4bd0
>      00000000000002a0  0000000000000004 AMS       0     0     16
> [10] .rodata           PROGBITS         ffffffff80fb5e70  00fb4e70
>      0000000000000108  0000000000000008  AM       0     0     8
> [11] .rodata           PROGBITS         ffffffff80fb5f78  00fb4f78
>      000000000000000c  0000000000000004 AMS       0     0     4
> [12] .rodata           PROGBITS         ffffffff80fb5f88  00fb4f88
>      0000000000001158  0000000000000001 AMS       0     0     8

Patch adds ability to add MergeInputSections to regular OutputSections.

Patch itself would not be so big, but it is heavily based on D23866 which removes
dependency on OutputSectionFactory for linkerscript. So largest changes belongs to D23866 here.

https://reviews.llvm.org/D23924

Files:
  ELF/InputFiles.cpp
  ELF/InputSection.cpp
  ELF/InputSection.h
  ELF/LinkerScript.cpp
  ELF/LinkerScript.h
  ELF/OutputSections.cpp
  ELF/OutputSections.h
  ELF/Writer.cpp
  test/ELF/linkerscript/linkerscript-mix-sections-gc.s
  test/ELF/linkerscript/linkerscript-mix-sections.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23924.69380.patch
Type: text/x-patch
Size: 17805 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160826/cb4becf0/attachment.bin>


More information about the llvm-commits mailing list