This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Linkerscript: merge section attributes when create output section.
AbandonedPublic

Authored by grimar on Aug 17 2016, 4:18 AM.

Details

Reviewers
ruiu
Summary

If there are input sections with the same name but with different attributes
and linker script layout is used then we create single output section.

What is wrong is that we create an output section based on the first input
section's attributes. This may make a wrong output section attributes,
patch fixes the issue.

Diff Detail

Event Timeline

grimar updated this revision to Diff 68333.Aug 17 2016, 4:18 AM
grimar retitled this revision from to [ELF] - Linkerscript: merge section attributes when create output section..
grimar updated this object.
grimar added a reviewer: ruiu.
grimar added subscribers: llvm-commits, grimar, davide, evgeny777.
ruiu added inline comments.Aug 22 2016, 2:00 AM
ELF/LinkerScript.cpp
11

V is a std::vector<InputSectionBase<ELFT> *>, but

11

S is a InputSectionBase<ELFT> *. How does it work?

Ping

ELF/LinkerScript.cpp
11

Do you mean call of updateFlags ? ArrayRef<InputSectionBase<ELFT> *> argument can be constructed from std::vector and as well as from single pointer:

/// Construct an ArrayRef from a single element.
/*implicit*/ ArrayRef(const T &OneElt)
  : Data(&OneElt), Length(1) {}
ruiu added inline comments.Aug 22 2016, 2:06 AM
ELF/LinkerScript.cpp
11

Looks like it's too subtle to me.

grimar updated this revision to Diff 68839.Aug 22 2016, 2:44 AM
  • Addressed review comments.
ELF/LinkerScript.cpp
11

Reimplemented.

ruiu added inline comments.Aug 22 2016, 2:48 AM
ELF/OutputSections.cpp
1830

This looks pretty tricky. Do you think you can make a change to not use OutputSectionFactory in LinkerScript first?

grimar added inline comments.Aug 22 2016, 2:52 AM
ELF/OutputSections.cpp
1830

Do you mean LinkerScript should have its own factory like in D23315 ?

grimar added inline comments.Aug 25 2016, 2:31 AM
ELF/OutputSections.cpp
1830

Change to avoid using OutputSectionsFactory is D23866

grimar abandoned this revision.Aug 31 2016, 5:35 AM