Bug 228876 - Fix ODR violations in JSC
Summary: Fix ODR violations in JSC
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-08-06 14:33 PDT by Michael Catanzaro
Modified: 2021-11-11 11:31 PST (History)
9 users (show)

See Also:


Attachments
Patch (3.77 KB, patch)
2021-08-06 14:36 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2021-08-06 14:33:20 PDT
When built with LTO enabled, GCC will warn about violations of C++'s one-definition rule. JSC currently has two violations. The first is JSC::SpeciesConstructResult, which has two different declarations:

runtime/ArrayPrototype.cpp:enum class SpeciesConstructResult {
runtime/JSArrayBufferPrototype.cpp:enum class SpeciesConstructResult : uint8_t {

There are usually several different ways to fix any particular ODR violation, starting with renaming one or the other use. I decided to add : uint8_t to the version in ArrayPrototype.cpp to make the declarations match. I could alternatively have placed them in anonymous namespaces to restrict them to file scope.

The next problem is JSC::SignalContext. We have two different versions of this struct, one in VMTraps.cpp and the other in SigillCrashAnalyzer.cpp. In this case, I decided the simplest approach would be to change the one in VMTraps.cpp from JSC::SignalContext to JSC::VMTraps::SignalContext.
Comment 1 Michael Catanzaro 2021-08-06 14:36:54 PDT
Created attachment 435090 [details]
Patch
Comment 2 Yusuke Suzuki 2021-08-07 15:13:23 PDT
Comment on attachment 435090 [details]
Patch

r=me
Comment 3 EWS 2021-08-07 15:40:32 PDT
Committed r280761 (240346@main): <https://commits.webkit.org/240346@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 435090 [details].
Comment 4 Radar WebKit Bug Importer 2021-08-07 15:41:17 PDT
<rdar://problem/81658888>