Closed Bug 1084157 Opened 6 years ago Closed 4 years ago

Make --enable-address-sanitizer pass the correct -fsanitize arguments to the toolchain

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: ehsan, Assigned: ehsan)

References

Details

Attachments

(1 file)

No description provided.
Assignee: nobody → ehsan.akhgari
Blocks: winasan
Attachment #8506572 - Flags: review?(mh+mozilla)
Attachment #8506572 - Flags: review?(mh+mozilla) → review+
glandium, can you please help me figure this out?

Here's the stuff that I have tried so far:

* I can reproduce the bustage locally with my patch applied.
* While trying to see what's different before and after my patch, I realized that before my patch, HOST_C/CXX/LDFLAGS contain -fsanitize=address but after my patch they don't, presumably because the in-tree ASAN mozconfigs don't set the HOST variables.  Adding the flag to the HOST_ counterparts in configure.in however did not help.
* Looking at the build logs from both before and after my patch, we build certutil.c (which is the NSS utility hit by this) both with -fsanitize=address, so the difference isn't there either.

Here is a link to my push earlier today: <https://treeherder.mozilla.org/ui/index.html#/jobs?repo=mozilla-inbound&revision=2b1c2663f92a>
Flags: needinfo?(mh+mozilla)
I bet the problem is that you *need* to link with -fsanitize=address. Well, that obviously won't work with link.exe, but it seems to me -fsanitize=address is making the compiler add something to the link command. IIRC, asan links a library so that'd be what it does. So you'd need to do that. Either by making the build link through clang, or by adding the right LDFLAGS.
Flags: needinfo?(mh+mozilla)
huh, except comment 4 is assuming the problem is with building clang-cl asan, which is not what the problem was.
Yeah, the linking should also be handled fine in my patch.  Do you have any other ideas?
Flags: needinfo?(mh+mozilla)
Try "export LDFLAGS=" in the mozconfig.
Flags: needinfo?(mh+mozilla)
(In reply to Mike Hommey [:glandium] from comment #7)
> Try "export LDFLAGS=" in the mozconfig.

That didn't help, unfortunately: https://tbpl.mozilla.org/?tree=Try&rev=d7f64393b11e
glandium, do you have any other ideas?  I've run out of them. :/
Flags: needinfo?(mh+mozilla)
Ping?
It looks like the necessary changes got applied in bug 1280637 (making --enable-*-sanitizer DTRT) and bug 1307547 (don't pass the sanitizer flags on windows).
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
Flags: needinfo?(mh+mozilla)
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.