---
title: "Option Soup: the subtle pitfalls of combining compiler flags"
description: "A Firefox 120 beta crash in std::locale::classic() on Ubuntu 18.04 traced back to a downstream build that combined -static-libstdc++ with the linker flag -Bsymbolic-functions."
url: "https://swe.quest/articles/option-soup-the-subtle-pitfalls-of-combining-compiler-flags-ee7121060b7d1c26"
canonical: "https://hacks.mozilla.org/2024/01/option-soup-the-subtle-pitfalls-of-combining-compiler-flags/"
source: "Mozilla Hacks"
published: "2024-01-29"
difficulty: "hard"
kind: "Incident"
reading_minutes: 8
tags: ["c-cpp","debugging","build-systems","linux","incident-response"]
---

# Option Soup: the subtle pitfalls of combining compiler flags

A post on [Mozilla Hacks](https://swe.quest/sources/mozilla-hacks.md), published 2024-01-29, 8 min read, Incident. Original: [https://hacks.mozilla.org/2024/01/option-soup-the-subtle-pitfalls-of-combining-compiler-flags/](https://hacks.mozilla.org/2024/01/option-soup-the-subtle-pitfalls-of-combining-compiler-flags/)

## Summary

A Firefox 120 beta crash in std::locale::classic() on Ubuntu 18.04 traced back to a downstream build that combined -static-libstdc++ with the linker flag -Bsymbolic-functions. Both the firefox binary and liblgpllibs.so embedded their own libstdc++. -Bsymbolic-functions bound function calls locally while exported variables (\_S\_once, \_S\_classic) were still interposed. One module therefore initialized the shared once-flag using pointers to its own private c\_locale, leaving the other module's copy uninitialized. The fix was to drop static libstdc++ in favor of dynamic linking with a bundled library via RPATH, and Firefox's configure now detects the setup after the same bug hit NixOS 23.05.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [C & C++](https://swe.quest/tags/c-cpp.md) (Languages)
- [Debugging](https://swe.quest/tags/debugging.md) (Engineering practices)
- [Build systems](https://swe.quest/tags/build-systems.md) (Engineering practices)
- [Linux](https://swe.quest/tags/linux.md) (Infrastructure)
- [Incidents & postmortems](https://swe.quest/tags/incident-response.md) (Reliability & operations)

## Prerequisites

- ELF shared libraries
- symbol interposition, PLT and GOT
- C++ static vs dynamic linking ([easy posts on C & C++](https://swe.quest/tags/c-cpp.md?difficulty=easy))

## Keywords

Firefox, libstdc++, -Bsymbolic-functions, -static-libstdc++, Ubuntu 18.04, NixOS, ANGLE, WebGL

## Related posts

- [Announcing Rust 1.99.1](https://swe.quest/articles/announcing-rust-1-99-1-ac4ba358fd1ed2e2.md): Rust Blog · 2026-10-15 · Medium · 1 min read · Rust, Compilers
  Rust 1.99.1 is a point release fixing three regressions. LLVM's loop-idiom-wcslen pass could emit calls to \`wcslen\` on targets lacking it, breaking UEFI builds using \`std\`, so compiler-builtins now provides a fallback.
- [Bun v1.1.7](https://swe.quest/articles/bun-v1-1-7-443b16215b4eb538.md): Bun · 2024-05-03 · Medium · 7 min read · JavaScript, Runtimes & VMs, Debugging
  Bun v1.1.7 fixes 28 bugs and adds glob patterns in package.json workspaces (via Bun.Glob), asymmetric matcher support in expect.extend's this.equals, and a working bunx --version.
- [Bun v1.0.9](https://swe.quest/articles/bun-v1-0-9-4679a702514c0ac7.md): Bun · 2023-11-05 · Medium · 3 min read · JavaScript, Build systems, Runtimes & VMs, CI/CD
  Bun v1.0.9 fixes regressions introduced by the v1.0.8 move from a hand-written Makefile to CMake and Ninja: "Illegal instruction" crashes on older x86 and some arm64 CPUs, and "symbol not found" errors on glibc older than 2.28 that broke Vercel.
- [Improving Firefox stability on Linux](https://swe.quest/articles/improving-firefox-stability-on-linux-d17615a93e9d8285.md): Mozilla Hacks · 2021-05-19 · Medium · 6 min read · Debugging, Linux, Observability, Open source, Rust
  Mozilla went from being able to symbolicate under 20% of Linux Firefox crash reports to over 99% by scraping debug information for distro-packaged Firefox builds and their dependencies (GTK, Mesa, fontconfig, SQLite, etc.) from Arch, Debian, Fedora, OpenSUSE and Ubuntu repositories.
- [Bun v1.0.36](https://swe.quest/articles/bun-v1-0-36-17df886795015fcd.md): Bun · 2024-03-29 · Medium · 6 min read · JavaScript, Runtimes & VMs, Linux
  Bun v1.0.36 fixes 13 bugs and adds Node.js-compatible fs.openAsBlob and fs.opendir.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
