This is an archive of the discontinued LLVM Phabricator instance.

LLD: COFF: Infer machine type earlier than before.
ClosedPublic

Authored by ruiu on Jul 9 2015, 11:21 AM.

Details

Reviewers
pcc
Summary

Previously, we infer machine type at the very end of linking after
all symbols are resolved. That's actually too late because machine
type affects how we mangle symbols (whether or not we need to
add "_").

For example, /entry:foo adds "_foo" to the symbol table if x86 but
"foo" if x64.

This patch moves the code to infer machine type, so that machine
type is inferred based on input files given via the command line
(but not based on .directives files).

Diff Detail

Event Timeline

ruiu updated this revision to Diff 29363.Jul 9 2015, 11:21 AM
ruiu retitled this revision from to LLD: COFF: Infer machine type earlier than before..
ruiu updated this object.
ruiu added a reviewer: pcc.
ruiu added a subscriber: llvm-commits.
pcc added inline comments.Jul 9 2015, 11:53 AM
COFF/Driver.cpp
211–212

You could add an assertion here that the machine type is known.

COFF/InputFiles.cpp
335–338

These don't look right. x86-32 and ARM both have a number of variants for the first part of the target triple. The llvm::Triple class can parse the triple for you.

ruiu updated this revision to Diff 29370.Jul 9 2015, 11:59 AM

Address Peter's comments.

pcc accepted this revision.Jul 9 2015, 12:42 PM
pcc edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jul 9 2015, 12:42 PM
Eugene.Zelenko added a subscriber: Eugene.Zelenko.

Committed in r241843.