[SERVER-18440] Can't pass -fsanitize-coverage to scons using CCFLAGS Created: 12/May/15 Updated: 01/Jun/22 Resolved: 01/Jun/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Build |
| Affects Version/s: | 3.1.2 |
| Fix Version/s: | Needs Further Definition |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Randolph Tan | Assignee: | Alex Neben |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
using clang v3.6.0
Attaching config.log. Note: Hacking SConstruct to pass -fsanitize-coverage=2 manually appears to work. |
| Comments |
| Comment by Kamran K. [ 22/May/15 ] | |||||||||||
|
The underlying issue is that the top-level SConstruct will run various configure checks before adding the sanitizer flags to support the '--sanitize=address' option. In contrast, the CCFLAGS values are passed directly to the configure checks, which leads to '-fsanitize-coverage=2' being passed without an accompanying -fsanitize=address option. This leads to these errors in config.log: "clang: error: argument unused during compilation: '-fsanitize-coverage=2'" | |||||||||||
| Comment by Kamran K. [ 20/May/15 ] | |||||||||||
|
I was able to get sanitizer coverage working with this command line: scons -j9 CCFLAGS="-fsanitize-coverage=3 -fsanitize=address" CC=/usr/bin/clang-3.6 CXX=/usr/bin/clang++-3.6 --opt=off --allocator=system --sanitize=address --variant-dir=asan core I haven't looked into why '-fsanitize=address' needs to be added to CCFLAGS despite --sanitize=address already being present, though. | |||||||||||
| Comment by Randolph Tan [ 13/May/15 ] | |||||||||||
|
Yes. It fully compiles and based on the logs, it looks like it is being passed to clang++ as a parameter. This is the diff for the hack:
| |||||||||||
| Comment by Ernie Hershey [ 13/May/15 ] | |||||||||||
|
Does it fully work when you hack SConstruct? I mean does the actual parameter get picked up and used? Or does it just not give a scons error? | |||||||||||
| Comment by Randolph Tan [ 12/May/15 ] | |||||||||||
|
I am starting to suspect that -fsanitize-coverage is not actually supported in 3.6 (it's quite confusing actually, the parameter is mentioned in --help, but I can't find it in the v3.6 documentation). I also suspect that the reason why the hack did not result in an error is we might be suppressing the warning as an error. |