This is an archive of the discontinued LLVM Phabricator instance.

Fix broken bitstream linking with lld when e_machine > 255
ClosedPublic

Authored by chrivers on Oct 10 2020, 5:39 AM.

Details

Summary

In lld's ELF/InputFiles.cpp, getBitcodeMachineKind() is limited to uint8_t return type.

This works as long as EM_xxx is < 256, which is true for common architectures,
but not for all targets.

The corresponding ELF field (e_machine) can hold uint16_t.

Diff Detail

Event Timeline

chrivers created this revision.Oct 10 2020, 5:39 AM
chrivers requested review of this revision.Oct 10 2020, 5:39 AM
MaskRay added a comment.EditedOct 10 2020, 9:17 AM

all (experimental) targets.

"experimental" is not appropriate. Just "all targets"

The corresponding ELF field can hold uint16_t, so change getBitcodeMachineKind() to uint16_t as well.

Just mention that it is e_machine

chrivers edited the summary of this revision. (Show Details)Oct 10 2020, 10:36 AM

Thanks for the feedback - I've updated the description to match.

MaskRay accepted this revision.Oct 10 2020, 11:49 AM

Looks great!

This revision is now accepted and ready to land.Oct 10 2020, 11:49 AM

Thanks for reviewing.

I don't have commit access - can someone help commit this?

(docs/Phabricator.rst says to mention that)

Thanks for reviewing.

I don't have commit access - can someone help commit this?

(docs/Phabricator.rst says to mention that)

I can do that. Can you provide git commit --amend --author='name <email>'?

Yes, please use:

git commit --amend --author='Christian Iversen <ci@iversenit.dk>'

Exciting. First llvm commit :)

This revision was landed with ongoing or failed builds.Oct 11 2020, 2:19 PM
This revision was automatically updated to reflect the committed changes.