This is an archive of the discontinued LLVM Phabricator instance.

[ms] [llvm-ml] Add support for the (many) optional SEGMENT parameters
ClosedPublic

Authored by epastor on Aug 9 2022, 2:17 PM.

Details

Summary

Add support for many parameters to the SEGMENT directive

Diff Detail

Event Timeline

epastor created this revision.Aug 9 2022, 2:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2022, 2:17 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
epastor requested review of this revision.Aug 9 2022, 2:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2022, 2:17 PM
thakis accepted this revision.Aug 10 2022, 8:09 AM

Looks great, thanks :)

llvm/lib/MC/MCParser/COFFMasmParser.cpp
190

If you use git clang-format main or git clang-format HEAD~, it'll only format lines you touched, not unrelated lines.

If you do want to reformat these lines, land this in an unrelated change.

261

nit: add tailing .

349

Should we warn on unknown classes?

This revision is now accepted and ready to land.Aug 10 2022, 8:09 AM
epastor updated this revision to Diff 451480.Aug 10 2022, 8:17 AM
epastor marked an inline comment as done.

Addressing feedback

epastor updated this revision to Diff 451482.Aug 10 2022, 8:19 AM
epastor marked 2 inline comments as done.

Removing another accidental reformat

llvm/lib/MC/MCParser/COFFMasmParser.cpp
349

Strangely, I don't think so - my testing suggests that ML64.EXE treats any unknown class as equivalent to DATA.

Ship it :)

llvm/lib/MC/MCParser/COFFMasmParser.cpp
349

Ah cool, even covered by tests.

thakis accepted this revision.Aug 10 2022, 8:29 AM
This revision was landed with ongoing or failed builds.Aug 10 2022, 8:57 AM
This revision was automatically updated to reflect the committed changes.
thakis added inline comments.Aug 10 2022, 9:08 AM
llvm/lib/MC/MCParser/COFFMasmParser.cpp
333

My bot remarks:

../../llvm/lib/MC/MCParser/COFFMasmParser.cpp(333,28): warning: comparison of integers of different signs: 'unsigned int' and 'int' [-Wsign-compare]
        if (Characteristic == -1) {
            ~~~~~~~~~~~~~~ ^  ~~

Either use static_cast<unsigned>(-1) or UINT_MAX.