This is an archive of the discontinued LLVM Phabricator instance.

[LLD][MinGW] Add --error-limit=<N> option
ClosedPublic

Authored by alvinhochun on Nov 5 2022, 6:24 AM.

Details

Summary

This maps to -errorlimit:<N> in the COFF linker and is functionally
identical to the same option in the ELF and MachO linker.

Diff Detail

Event Timeline

alvinhochun created this revision.Nov 5 2022, 6:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 5 2022, 6:24 AM
alvinhochun requested review of this revision.Nov 5 2022, 6:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 5 2022, 6:24 AM
mstorsjo accepted this revision.Nov 7 2022, 3:03 AM
mstorsjo added a reviewer: rnk.

Looks fine to me overall, one minor nit to address, and a little discussion on some details.

lld/MinGW/Driver.cpp
397

It's somewhat unusual to interpret the argument values that much in the mingw driver (except in the cases where they need to be rewritten), but I see the intent of making the error message mention the right name - so it's probably fine.

(Technically I guess we have that issue for any other argument too, where we just pass values on blindly, and the COFF linker may complain about their values later on.)

lld/test/MinGW/error-limit.test
12

I think it'd be nice with a : after the option name here; in the case of the COFF driver, the option name itself contains it so there's no need, but e.g. the ELF linker seems to manually add it in some similar cases.

14

I think we don't have any lld mingw driver tests that actually invoke the coff linker, all of them just use -### to see what it outputs. Strictly speaking, we tend to avoid such tests, although this one seems harmless (although kinda redundant, as this gets covered in total by the other testcases too)?

This revision is now accepted and ready to land.Nov 7 2022, 3:03 AM

Added : in the error message and removed a redundant test in MinGW/error-limit.test

This revision was automatically updated to reflect the committed changes.