Closed Bug 1608460 Opened 6 years ago Closed 6 years ago

Redefine MIDL names to be unique to work around a clang-cl bug

Categories

(Firefox Build System :: Toolchains, defect)

defect
Not set
normal

Tracking

(firefox74 fixed)

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: away, Assigned: away)

Details

Attachments

(1 file)

https://llvm.org/pr41817 has prevented us from building MIDL code with clang-cl for some time now. The bug causes some static globals to lose their static-ness and leak the symbols to the outside world, so we get duplicate symbol errors when we link multiple MIDL TUs together.

We've been working around it by carrying a local LLVM patch that reverts the change where the bug was introduced. This has two downsides that have been increasingly annoying me: (1) we have to rebase that patch when we update LLVM, and (2) you have to remember to apply this patch locally when building your own LLVM, or else it'll fail to build Firefox.

An alternative workaround is to use the preprocessor to give the problematic objects unique names. Then we can drop the LLVM patch. The change is super ugly, but given the problems above I'm starting to see it as the lesser of evils.

This is an alternative to carrying a revert of the offending changeset, since the bug doesn't show hope of a fix anytime soon, or maybe ever. This way we don't have to keep rebasing the patch as we pick up new clangs, and developers don't have to remember to apply the patch when building a local compiler.

Assignee: nobody → dmajor
Status: NEW → ASSIGNED
Pushed by dmajor@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/faddb73036a3 Redefine MIDL names to be unique to work around a clang-cl bug r=froydnj
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: