This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj] Align section content using AddressAlign field's value
ClosedPublic

Authored by atanasyan on Jul 3 2015, 4:53 PM.

Details

Reviewers
silvas
atanasyan
Summary

Use AddressAlign field's value to properly align sections content in the yaml2obj tool. Before this change the yaml2obj ignored AddressAlign and always aligned section on 16 bytes boundary.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan updated this revision to Diff 29039.Jul 3 2015, 4:53 PM
atanasyan retitled this revision from to [yaml2obj] Align section content using AddressAlign field's value.
atanasyan updated this object.
atanasyan added a reviewer: silvas.
atanasyan set the repository for this revision to rL LLVM.
atanasyan added a subscriber: llvm-commits.
silvas edited edge metadata.Jul 6 2015, 4:57 PM

Nice catch. The test seems really brittle though, since it depends on the exact offset. Can you instead ask for an alignment larger than the previous default, then regex check that the offset has sufficient trailing zeros? (hopefully make the alignment large enough that there is a low probability that it could happen by accident, but small enough that the resulting filesize isn't enormous/the test is still fast to execute)

atanasyan updated this revision to Diff 29155.Jul 7 2015, 12:31 AM
atanasyan edited edge metadata.

Do not stick to the exact offset value in the test. Check number of trailing zeros.

silvas added a comment.Jul 7 2015, 8:52 PM

Two nits, otherwise LGTM.

test/Object/yaml2obj-elf-alignment.yaml
2

Typo 'accoun'

test/Object/yaml2obj-elf-section-basic.yaml
55 ↗(On Diff #29155)

Can you commit a separate patch to just change these tests to regex match this field? I don't think the exact offset matters for what these are testing.

atanasyan updated this revision to Diff 29244.Jul 8 2015, 12:02 AM
  • The typo is fixed
  • yaml2obj-elf-rel.yaml and yaml2obj-elf-section-basic.yaml fixed by a separate commit rL241669 using regex.
silvas added a comment.Jul 8 2015, 1:10 AM

Thanks. Feel free to commit this anytime.

atanasyan accepted this revision.Feb 3 2016, 12:39 AM
atanasyan added a reviewer: atanasyan.
This revision is now accepted and ready to land.Feb 3 2016, 12:39 AM