This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Fix entry count for __llvm_prf_data on i386 Darwin
ClosedPublic

Authored by vsk on Feb 25 2016, 4:42 PM.

Details

Summary

Compiler-rt miscalculates the number of entries in the __llvm_prf_data section on i386 Darwin. This results in a number of test failures (which we started catching after r261344).

The fix we attempted earlier is insufficient (r261683). It caused some tests to start passing again, but that hid the fact that we drop data entries.

This patch should fix the real problem. It fixes the way we compute DataSize by taking into account the way the Darwin linker lays out __llvm_prf_data.

Diff Detail

Event Timeline

vsk updated this revision to Diff 49120.Feb 25 2016, 4:42 PM
vsk retitled this revision from to [compiler-rt] Fix entry count for __llvm_prf_data on i386 Darwin.
vsk updated this object.
vsk added a reviewer: davidxl.
vsk added subscribers: lhames, mschifer, llvm-commits.
davidxl added inline comments.Feb 25 2016, 4:56 PM
lib/profile/InstrProfilingBuffer.c
31

Probably just

EndI = (llvm_profile_data *) ((intptr_t)End + sizeof(llvm_profile_data) -1);
return EndI - Begin;

vsk updated this revision to Diff 49140.Feb 25 2016, 6:15 PM
  • Simplify according to David's comment, but prefer not to do arithmetic on unaligned pointers.
davidxl accepted this revision.Feb 25 2016, 6:47 PM
davidxl edited edge metadata.

lgtm

This revision is now accepted and ready to land.Feb 25 2016, 6:47 PM
This revision was automatically updated to reflect the committed changes.