This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Check that output sections fit in address space.
ClosedPublic

Authored by grimar on Feb 27 2018, 6:37 AM.

Details

Diff Detail

Event Timeline

grimar created this revision.Feb 27 2018, 6:37 AM

Seems reasonable to me. A few nit comments though.

ELF/Writer.cpp
1986

addresses -> address

1991–1992

This comment looks like it's wrapped early?

2003–2004

Ditto comment wrapping. Also "Any" -> "any".

grimar updated this revision to Diff 136073.Feb 27 2018, 6:56 AM
  • Addressed comments. Thanks, James !
espindola edited reviewers, added: espindola; removed: rafael.Mar 15 2018, 8:34 AM

Do we want it?

espindola accepted this revision.Apr 2 2018, 2:12 PM

LGTM with nits.

ELF/Writer.cpp
1995

This is templated on ELFT, may as well use it.

It might be cleaner to write this as one check
(OS->Addr + OS->Size < OS->Addr) || (!ELF::Is64Bits && OS->Addr + OS->Size > UINT32_MAX)

This revision is now accepted and ready to land.Apr 2 2018, 2:12 PM
This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.
ruiu added inline comments.Apr 3 2018, 10:13 AM
ELF/Writer.cpp
1991–1992

You should have changed the name of this function because it does more than checking section overlaps.

grimar added inline comments.Apr 4 2018, 2:27 AM
ELF/Writer.cpp
1991–1992

I renamed it to checkSections, it matches the command line option name. Does it sound fine?