This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Do not produce broken .dynamic section with --no-rosegment
ClosedPublic

Authored by grimar on Oct 5 2017, 4:14 AM.

Details

Summary

LLD produces broken .dynamic section when --no-rosegment and at least one
of following options is present:

  1. -z rodynamic is given.
  2. MIPS target.

That happens because code that writes .dynamic assumes target buffer is zero-filled,
what can be not true after LLD fills it with trap-instructions. With one of two options
above, .dynamic becomes SHF_ALLOC section, so can be affected.

Diff Detail

Event Timeline

grimar created this revision.Oct 5 2017, 4:14 AM
grimar updated this revision to Diff 117796.Oct 5 2017, 4:28 AM
  • Simplified testcase.
ruiu accepted this revision.Oct 5 2017, 7:50 PM

LGTM

ELF/SyntheticSections.cpp
1174

Look at line 1073 (it is always good to look around when you add code to an existing file). For consistency, 0ULL -> (uint64_t)0.

This revision is now accepted and ready to land.Oct 5 2017, 7:50 PM
This revision was automatically updated to reflect the committed changes.