[PATCH] D27415: [ELF] - Replace MergeOutputSection with synthetic input section MergeSection.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 08:18:32 PST 2016


grimar added inline comments.


================
Comment at: ELF/LinkerScript.cpp:351
 
+      combineMergableSections(V);
+
----------------
ruiu wrote:
> grimar wrote:
> > ruiu wrote:
> > > Why do you have to do this in LinkerScript.cpp? It feels something is not right. Section aggregation should happen before the control is passed to the linker script.
> > How it can be possible ?
> > 
> > Imagine script has:
> > 
> > .mergeable : { *(.aaa) *(.bbb) EXCLUDE_FILE (*file1.o) *(.ccc) }
> > 
> > I am able to merge them only after I have some result from createInputSectionList(), no ? Until that I don't know which sections should I combine.
> I don't think you need to handle that case.
If so, do you think using elf::getOutputSectionName() for naming synthetic merge inputs for script case is ok ?

That way if .data.xxx and .data.yyy are mergeable and script has:
.data : { *(.data*) }
.only_data_xxx : { *(.data.xxx) }
.only_data_yyy : { *(.data.yyy) }
.data.xxx and .data.yyy will be combined into mergeable .data and placed into .data output section.

But according to above, we dont want to handle such cases ? 
I am just asking, because see no other appropriate method except use of getOutputSectionName() on early stages then.
As leaving input sections names as is probably not an option as this kills the possible merging cases.


https://reviews.llvm.org/D27415





More information about the llvm-commits mailing list