This is an archive of the discontinued LLVM Phabricator instance.

[lld] Handle empty CIE augmentation field
ClosedPublic

Authored by emaste on May 4 2016, 10:33 AM.

Details

Summary

Search for the CIE augmentation null terminator from the first byte of the field. If the field is empty the terminator is the first byte.

While testing linking FreeBSD/mips64 with lld I encountered CIE code alignment must be 1, with the root cause being the empty Augmentation string:

From readelf --debug-dump lib/libc/cancelpoints_sem_new.So:

00000000 0000000c ffffffff CIE
  Version:               1
  Augmentation:          ""
  Code alignment factor: 1
  Data alignment factor: -4
  Return address column: 31

  DW_CFA_def_cfa: r29 ofs 0

Unfortunately I don't have a good test for this yet.

Diff Detail

Repository
rL LLVM

Event Timeline

emaste updated this revision to Diff 56169.May 4 2016, 10:33 AM
emaste retitled this revision from to [lld] Handle empty CIE augmentation field.
emaste updated this object.
emaste added reviewers: rafael, grimar, atanasyan.
emaste set the repository for this revision to rL LLVM.
grimar accepted this revision.May 5 2016, 1:15 AM
grimar edited edge metadata.

That is LGTM.

This revision is now accepted and ready to land.May 5 2016, 1:15 AM
atanasyan edited edge metadata.May 5 2016, 1:19 AM

LGTM

What's problem with the test case? Is it hard to reproduce the bug or create input file which has an empty augmentation string?

grimar added a comment.May 5 2016, 1:30 AM

I guess creating input file from asm with empty augmentation string is the problem.

I guess creating input file from asm with empty augmentation string is the problem.

In that case we can use existing binary. It is worse than asm code but better than no test case at all.

emaste updated this revision to Diff 58232.May 24 2016, 7:02 AM
emaste edited edge metadata.
emaste removed rL LLVM as the repository for this revision.

Rebase after rL270526

I don't have a trivial/small binary that demonstrates the problem yet. Should I commit with a larger object, commit without a test, or wait for a smaller reproduction case?

This revision was automatically updated to reflect the committed changes.