Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-08 Thread Richard Smith via cfe-commits
On Thu, Sep 8, 2016 at 12:06 PM, Filipe Cabecinhas < filcab+llvm.phabrica...@gmail.com> wrote: > It seems some people on this thread (I'm sorry if everyone is taking this > into account, but it seemed to me that this was going unnoticed, I want to > make sure everyone is on the same page) is only

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-08 Thread Richard Smith via cfe-commits
On Thu, Sep 8, 2016 at 11:19 AM, Anna Zaks wrote: > zaks.anna added a comment. > > > I don't see the point of adding another flag to control this when we > already have a perfectly good set of > > > flags that already do the right thing -- that takes us three levels > deep

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-08 Thread Filipe Cabecinhas via cfe-commits
It seems some people on this thread (I'm sorry if everyone is taking this into account, but it seemed to me that this was going unnoticed, I want to make sure everyone is on the same page) is only talking about linking (or not) the sanitizer runtimes. But that's not the only thing. Depending on

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-08 Thread Anna Zaks via cfe-commits
zaks.anna added a comment. > I don't see the point of adding another flag to control this when we already > have a perfectly good set of > flags that already do the right thing -- that takes us three levels deep in > flags overriding the behavior of > other flags, and I don't see how it

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-08 Thread Richard Smith via cfe-commits
rsmith added a comment. In https://reviews.llvm.org/D24048#537257, @beanz wrote: > @kubabrecka, I can understand where you're coming from about the option > starting with `-fsanitize`, but I disagree for two reasons. First, I think > that it is more important for the option to be concise and

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-08 Thread Chris Bieneman via cfe-commits
beanz added a comment. There are basically two solutions being debated. Either make `-fsanitize=...` bypass `-nostdlib` `-nodefaultlibs` or support a flag that explicitly bypasses it. Personally I think the flag is probably the better way to go because it is more explicit, and has less

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-08 Thread Chris Bieneman via cfe-commits
beanz updated this revision to Diff 70709. beanz added a comment. - Updated with FreeBSD and GNUTools support for -flink-sanitizer-runtimes https://reviews.llvm.org/D24048 Files: include/clang/Driver/Options.td lib/Driver/ToolChains.cpp lib/Driver/ToolChains.h lib/Driver/Tools.cpp

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-08 Thread Kuba Brecka via cfe-commits
kubabrecka added a comment. Anyone who uses `-nostdlib` or `-nodefaultlibs` has to be aware that his program will be linked with less stuff than usual and has to expect linker error. If such a user doesn’t know that ASan and TSan require a dylib on macOS, he should be able to figure this out

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-07 Thread Anna Zaks via cfe-commits
zaks.anna added a comment. > -fsanitize=* as a driver argument *when linking* is an explicit request to > link against the sanitizer runtimes. Sanitizer users pass this option to the clang driver to get the runtime checking. Not all of them understand the implications and immediately realize

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-07 Thread Justin Bogner via cfe-commits
Richard Smith writes: > My 2c: `-nodefaultlibs` means "don't link against any libraries I > didn't explicitly tell you to". `-fsanitize=*` as a driver argument > *when linking* is an explicit request to link against the sanitizer > runtimes. So that should win. If you don't

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-07 Thread Eric Fiselier via cfe-commits
+1 On Wed, Sep 7, 2016 at 6:04 PM, Richard Smith wrote: > rsmith added a subscriber: rsmith. > rsmith added a comment. > > My 2c: `-nodefaultlibs` means "don't link against any libraries I didn't > explicitly tell you to". `-fsanitize=*` as a driver argument *when

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-07 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith. rsmith added a comment. My 2c: `-nodefaultlibs` means "don't link against any libraries I didn't explicitly tell you to". `-fsanitize=*` as a driver argument *when linking* is an explicit request to link against the sanitizer runtimes. So that should win. If

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-07 Thread Chris Bieneman via cfe-commits
beanz updated this revision to Diff 70624. beanz added a comment. - Added new driver flag -flink-sanitizer-runtimes which forces linking sanitizer runtimes. Additional cleanup will be required to support the GNUTools and FreeBSD drivers as well as making the Darwin behavior more consistent. I

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-06 Thread Vitaly Buka via cfe-commits
vitalybuka resigned from this revision. vitalybuka removed a reviewer: vitalybuka. vitalybuka added a comment. I have no strong opinion on that. There is already exception for startfiles, so maybe sanitizes are OK as well. https://reviews.llvm.org/D24048

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-02 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment. I would also expect -nodefaultlibs and -nostdlib to remove all standard libraries from the link command line, including the sanitizer ones. I like the idea of -flink-sanitizer-runtime=address, but may be without "address" - the set of sanitizer runtime libraries can be

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-01 Thread Chris Bieneman via cfe-commits
beanz added a comment. @zaks.anna, changing the build system to explicitly select which sanitizer runtime to use is more complicated than it might seem. The sanitizer runtime libraries are named differently by toolchain, so correctly selecting a library would involve either duplicating

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-01 Thread Kostya Serebryany via cfe-commits
kcc added reviewers: vitalybuka, eugenis. kcc added a comment. Sorry, I won't have a chance to look at it before late next week. Adding two more folks in case they have ideas. https://reviews.llvm.org/D24048 ___ cfe-commits mailing list

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-01 Thread Chris Bieneman via cfe-commits
beanz added a subscriber: filcab. beanz added a comment. To address both @bogner and @gribozavr... The problem is we're wildly inconsistent on what -nodefaultlibs and -nostdlibs mean. For example, on GNUTools or FreeBSD -fsanitize *always* adds sanitizer libraries regardless of the presence

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-01 Thread Dmitri Gribenko via cfe-commits
gribozavr added a subscriber: gribozavr. gribozavr added a comment. > If a user specifies "-fsanitize=" I think it is expected that the > sanitizer library would be included on the link line. I deeply disagree. If the user asks for `-nodefaultlibs`, we should not add any libraries ourselves,

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-09-01 Thread Justin Bogner via cfe-commits
Chris Bieneman writes: > beanz created this revision. > beanz added reviewers: zaks.anna, kubabrecka, bogner. > beanz added a subscriber: cfe-commits. > > The -nodefaultlibs and -nostdlib flags suppress all the runtime > libraries that the driver puts on the link line. This feels

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-08-31 Thread Chris Bieneman via cfe-commits
beanz added a comment. @zaks.anna, the driver behind this is supporting building libcxx with sanitizers. The drivers for GNUTools and FreeBSD already support this workflow. I have updates to the test in https://reviews.llvm.org/D24091, which also cover this code. I'll push the updated test

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-08-31 Thread Chris Bieneman via cfe-commits
beanz added a comment. I've sent out an additional patch that adds a warning for using -nostdlibs and -fsanitize (See: https://reviews.llvm.org/D24091) https://reviews.llvm.org/D24048 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-08-30 Thread Filipe Cabecinhas via cfe-commits
Haha, the joke is on me. I had the opposite opinion two years ago (I guess by virtue of working on the sanitizers for a while, I've come to see them as default libs?). Making the behavior more consistent is good, and the r218541 discussion (+220455) makes me think your patch is good. We end up

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-08-30 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a subscriber: bruno. bruno added a comment. Regardless of the way we decide to go with this, it would be nice if a driver level warning is used to tell users about any non-obvious assumed behavior when these flags are used together. https://reviews.llvm.org/D24048

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-08-30 Thread Chris Bieneman via cfe-commits
Filipe, You say that, but the darwin driver’s behavior is different from the FreeBSD or GNUTools behavior. This patch provides the GNUTools & FreeBSD behavior via the Darwin driver. -Chris > On Aug 30, 2016, at 12:26 PM, Filipe Cabecinhas > wrote: > > I

Re: [PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-08-30 Thread Filipe Cabecinhas via cfe-commits
I don't think so. "No default libs" should mean "no default libs", not "some default libs". Maybe you're using an alternate sanitizer lib or something, hence usage of that flag. Thank you, Filipe On Tuesday, 30 August 2016, Chris Bieneman via cfe-commits < cfe-commits@lists.llvm.org> wrote: >

[PATCH] D24048: [Driver] [Darwin] Add sanitizer libraries even if -nodefaultlibs is passed

2016-08-30 Thread Chris Bieneman via cfe-commits
beanz created this revision. beanz added reviewers: zaks.anna, kubabrecka, bogner. beanz added a subscriber: cfe-commits. The -nodefaultlibs and -nostdlib flags suppress all the runtime libraries that the driver puts on the link line. This feels wrong. If a user specifies "-fsanitize=" I think