This is an archive of the discontinued LLVM Phabricator instance.

Add --warn-unresolved-symbols and --error-unresolved-symbols options
ClosedPublic

Authored by dmikulin on Jan 25 2017, 2:36 PM.

Details

Summary

Added the following options for compatibility with binutils ld:

--warn-unresolved-symbols   Report unresolved symbols as warnings
--error-unresolved-symbols  Report unresolved symbols as errors

Diff Detail

Repository
rL LLVM

Event Timeline

dmikulin created this revision.Jan 25 2017, 2:36 PM
ruiu added inline comments.Jan 25 2017, 5:19 PM
ELF/Driver.cpp
347 ↗(On Diff #85809)

You don't need to check if it is OPT_error_undef because it always have to be that. You can just return ReportError.

dmikulin updated this revision to Diff 85847.Jan 25 2017, 5:40 PM

Added test points to make sure errors/warnings are not issued in relocatable and shared links.
Removed the unnecessary check to return ReportError.

davide requested changes to this revision.Jan 25 2017, 5:49 PM

Some comments inline.

test/ELF/warn-unresolved-symbols.s
2–3 ↗(On Diff #85847)

Do you really need two object files? If not, you can probably simplify this test a bit.

23–32 ↗(On Diff #85847)

gold and bfd accept both the single dash and the double dash variant of this option.
You can change some of the invocations here to - in order to make sure we support it correctly.

This revision now requires changes to proceed.Jan 25 2017, 5:49 PM
emaste added a subscriber: emaste.Jan 25 2017, 5:52 PM
emaste added inline comments.
test/ELF/warn-unresolved-symbols.s
23–32 ↗(On Diff #85847)

In general gold and bfd accept - and -- for everything except options starting with 'o'.

dmikulin updated this revision to Diff 85849.Jan 25 2017, 6:09 PM
dmikulin edited edge metadata.

Got rid of the second file in the test case and added single - test points for options.

davide accepted this revision.Jan 25 2017, 6:13 PM

LGTM. Rui?

This revision is now accepted and ready to land.Jan 25 2017, 6:13 PM
ruiu accepted this revision.Jan 25 2017, 6:23 PM

LGTM

This revision was automatically updated to reflect the committed changes.

Committed as r293139. Thanks for your contribution. I'll close the related PR for you as you don't have a bugzilla account yet (*sigh*). You may want to reference the PR number (if any) in the summary of your future reviews, FWIW.