This is an archive of the discontinued LLVM Phabricator instance.

Keep flags from phantom synthetic sections
ClosedPublic

Authored by espindola on Feb 23 2018, 4:33 PM.

Details

Summary

This fixes pr36475.

I think this code can be simplified a bit, but I would like to check in the more direct fix if we are in agreement on the direction and then refactor.

This is not something that bfd does. The issue is not noticed in bfd because it keeps fewer sections from the linkerscript in the output.

The reasons why it seems reasonable to do this:

  • As George noticed, we would still keep the flags if the output section had both an empty synthetic section and a regular section
  • We need an heuristic to find the flags of output sections. Using the flags of a synthetic section that would have been there seems a reasonable heuristic.

Diff Detail

Event Timeline

espindola created this revision.Feb 23 2018, 4:33 PM
grimar accepted this revision.Feb 25 2018, 11:42 PM

LGTM

This revision is now accepted and ready to land.Feb 25 2018, 11:42 PM
jhenderson accepted this revision.Feb 26 2018, 1:29 AM

LGTM, with a couple of comment nits.

ELF/Writer.cpp
1386–1387

Might want to revert this comment back to what it used to say.

test/ELF/linkerscript/empty-synthetic-removed-flags.s
8

have -> has

espindola closed this revision.Feb 26 2018, 2:37 PM