This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Warn on -nodefaultlibs and -fsanitize
Needs ReviewPublic

Authored by beanz on Aug 31 2016, 10:38 AM.

Details

Summary

The FreeBSD and GNUTools drivers support -fsanitize arguments bypassing -nodefaultlibs. With https://reviews.llvm.org/D24048, Darwin will support that behavior as well.

To make this a little less magical and behind the curtain this warning will fire when -nodefaultlibs is used with sanitizer arguments.

Diff Detail

Event Timeline

beanz updated this revision to Diff 69879.Aug 31 2016, 10:38 AM
beanz retitled this revision from to [Driver] Warn on -nodefaultlibs and -fsanitize.
beanz updated this object.
beanz added reviewers: bogner, zaks.anna, bruno, filcab.
beanz added a subscriber: cfe-commits.
bruno edited edge metadata.Aug 31 2016, 11:35 AM

Hi Chris,

Thanks for doing this.

lib/Driver/Driver.cpp
1555

How hard is to fire the warning only when the target assumes this behavior? It seems misleading (and noisy) to warn when -nodefaultlibs isn't bypassed.

beanz added a comment.Aug 31 2016, 1:09 PM

I can change the implementation, but that quickly falls into target specific driver code. It results in adding the warning in one place for Darwin, another for FreeBSD, and a third for GNUTools.

If that is the preferred way I can work up that patch.

beanz updated this revision to Diff 69910.Aug 31 2016, 3:12 PM
beanz edited edge metadata.

Updates based on bruno's feedback.

bruno added inline comments.Aug 31 2016, 3:43 PM
include/clang/Basic/DiagnosticDriverKinds.td
276

What about something like: "-nodefaultlibs does not skip sanitizer runtime libs when used with -fsanitize." ?

beanz updated this revision to Diff 69926.Aug 31 2016, 4:42 PM
  • Changed warning text based on feedback from bruno
  • Made the warning apply to -nostdlib as well as -nodefaultlibs based on offline discussion with Anna
bruno resigned from this revision.Nov 9 2020, 11:54 AM