Bug 193726 - Duplicate global variables: WTF::asciiCaseFoldTable
Summary: Duplicate global variables: WTF::asciiCaseFoldTable
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-01-23 10:10 PST by David Kilzer (:ddkilzer)
Modified: 2019-01-24 02:40 PST (History)
11 users (show)

See Also:


Attachments
Patch v1 (12.47 KB, patch)
2019-01-23 10:20 PST, David Kilzer (:ddkilzer)
mcatanzaro: review+
Details | Formatted Diff | Diff
Patch v2 (test Windows build fix) (12.51 KB, patch)
2019-01-23 11:38 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v3 (test Windows build fix again) (12.59 KB, patch)
2019-01-23 13:31 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v4 (test Windows build fix #3) (12.60 KB, patch)
2019-01-23 19:29 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2019-01-23 10:10:39 PST
Because WTF::asciiCaseFoldTable is defined in the Source/WTF/wtf/ASCIICType.h header, there are duplicate copies in every major framework on Release-iphoneos builds:

$ nm -a $BUILD_DIR/Release-iphoneos/JavaScriptCore.framework/JavaScriptCore | grep -i asciiCaseFoldTable
0000000000bcefa8 s __ZN3WTFL18asciiCaseFoldTableE
0000000000bcefa8 - 04 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
0000000000bcf0a8 s __ZN3WTFL18asciiCaseFoldTableE
0000000000bcf0a8 - 04 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
0000000000bcfbf0 - 04 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
0000000000bcfbf0 s __ZN3WTFL18asciiCaseFoldTableE
0000000000bd0060 - 04 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
0000000000bd0060 s __ZN3WTFL18asciiCaseFoldTableE
0000000000bd0170 s __ZN3WTFL18asciiCaseFoldTableE
0000000000bd0170 - 04 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
0000000000bd0580 - 04 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
0000000000bd0580 s __ZN3WTFL18asciiCaseFoldTableE
0000000000bf5ae4 s __ZN3WTFL18asciiCaseFoldTableE
0000000000bf5ae4 - 04 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE

$ nm -a $BUILD_DIR/Release-iphoneos/WebCore.framework/WebCore | grep -i asciiCaseFoldTable
00000000018b57e8 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018b57e8 s __ZN3WTFL18asciiCaseFoldTableE
00000000018b5964 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018b5964 s __ZN3WTFL18asciiCaseFoldTableE
00000000018bac18 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018bac18 s __ZN3WTFL18asciiCaseFoldTableE
00000000018ca4b0 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018ca4b0 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d613c s __ZN3WTFL18asciiCaseFoldTableE
00000000018d613c - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d6530 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d6530 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d6640 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d6640 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d74a8 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d74a8 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d7788 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d7788 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d7ab0 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d7ab0 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d7c18 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d7c18 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d7d5f s __ZN3WTFL18asciiCaseFoldTableE
00000000018d7d5f - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d7e78 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d7e78 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d7ff8 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d7ff8 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d81a8 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d81a8 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d8310 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d8310 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d84ad - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d84ad s __ZN3WTFL18asciiCaseFoldTableE
00000000018d88c8 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d88c8 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d8a90 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d8a90 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d8be8 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018d8be8 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d8d10 s __ZN3WTFL18asciiCaseFoldTableE
00000000018d8d10 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018dcfde s __ZN3WTFL18asciiCaseFoldTableE
00000000018dcfde - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018dd160 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018dd160 s __ZN3WTFL18asciiCaseFoldTableE
00000000018dd268 s __ZN3WTFL18asciiCaseFoldTableE
00000000018dd268 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018dd998 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018dd998 s __ZN3WTFL18asciiCaseFoldTableE
00000000018ddb1c s __ZN3WTFL18asciiCaseFoldTableE
00000000018ddb1c - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018de070 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018de070 s __ZN3WTFL18asciiCaseFoldTableE
00000000018dee38 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018dee38 s __ZN3WTFL18asciiCaseFoldTableE
00000000018def7d - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018def7d s __ZN3WTFL18asciiCaseFoldTableE
00000000018df3b0 s __ZN3WTFL18asciiCaseFoldTableE
00000000018df3b0 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018e0d1c s __ZN3WTFL18asciiCaseFoldTableE
00000000018e0d1c - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018e12ec s __ZN3WTFL18asciiCaseFoldTableE
00000000018e12ec - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018e5a60 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018e5a60 s __ZN3WTFL18asciiCaseFoldTableE
00000000018e5bb4 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018e5bb4 s __ZN3WTFL18asciiCaseFoldTableE
00000000018e5d88 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
00000000018e5d88 s __ZN3WTFL18asciiCaseFoldTableE

$ nm -a $BUILD_DIR/Release-iphoneos/WebKitLegacy.framework/WebKitLegacy | grep -i asciiCaseFoldTable
000000000012d8a0 s __ZN3WTFL18asciiCaseFoldTableE
000000000012d8a0 - 04 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
000000000012d9c4 s __ZN3WTFL18asciiCaseFoldTableE
000000000012d9c4 - 04 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE

$ nm -a $BUILD_DIR/Release-iphoneos/WebKit.framework/WebKit | grep -i asciiCaseFoldTable
0000000000454410 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
0000000000454410 s __ZN3WTFL18asciiCaseFoldTableE
000000000045497c - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
000000000045497c s __ZN3WTFL18asciiCaseFoldTableE
0000000000455ab8 s __ZN3WTFL18asciiCaseFoldTableE
0000000000455ab8 - 05 0000 STSYM __ZN3WTFL18asciiCaseFoldTableE
Comment 1 David Kilzer (:ddkilzer) 2019-01-23 10:20:12 PST
Created attachment 359901 [details]
Patch v1

Will wait to commit until internal perf tests are completed.
Comment 2 David Kilzer (:ddkilzer) 2019-01-23 10:22:56 PST
<rdar://problem/47334622>
Comment 3 Michael Catanzaro 2019-01-23 10:47:42 PST
Comment on attachment 359901 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=359901&action=review

> Source/WTF/wtf/ASCIICType.h:73
> +extern WTF_EXPORT const unsigned char asciiCaseFoldTable[256];

I think the extern keyword is redundant.
Comment 4 David Kilzer (:ddkilzer) 2019-01-23 11:15:02 PST
(In reply to Michael Catanzaro from comment #3)
> Comment on attachment 359901 [details]
> Patch v1
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=359901&action=review
> 
> > Source/WTF/wtf/ASCIICType.h:73
> > +extern WTF_EXPORT const unsigned char asciiCaseFoldTable[256];
> 
> I think the extern keyword is redundant.

It's not (I went through this thought exercise in Bug 193607 as well):

In file included from Source/WTF/wtf/Assertions.cpp:43:
In file included from $BUILD_DIR/Release-iphoneos/usr/local/include/wtf/LoggingAccumulator.h:28:
In file included from $BUILD_DIR/Release-iphoneos/usr/local/include/wtf/text/WTFString.h:31:
In file included from $BUILD_DIR/Release-iphoneos/usr/local/include/wtf/text/StringImpl.h:27:
$BUILD_DIR/Release-iphoneos/usr/local/include/wtf/ASCIICType.h:73:32: error: default initialization of an object of const type 'const unsigned char [256]'
WTF_EXPORT const unsigned char asciiCaseFoldTable[256];
                               ^
1 error generated.
Comment 5 David Kilzer (:ddkilzer) 2019-01-23 11:27:43 PST
Hmm...do I need to move the WTF_EXPORT macro from the header to the source file?

     Creating library C:/cygwin/home/buildbot/WebKit/WebKitBuild/Release/lib32/TestWTFLib.lib and object C:/cygwin/home/buildbot/WebKit/WebKitBuild/Release/lib32/TestWTFLib.exp
StringImpl.obj : error LNK2001: unresolved external symbol "unsigned char const * const WTF::asciiCaseFoldTable" (?asciiCaseFoldTable@WTF@@3QBEB) [C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\Tools\TestWebKitAPI\TestWTFLib.vcxproj]
StringView.obj : error LNK2001: unresolved external symbol "unsigned char const * const WTF::asciiCaseFoldTable" (?asciiCaseFoldTable@WTF@@3QBEB) [C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\Tools\TestWebKitAPI\TestWTFLib.vcxproj]
C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\bin32\TestWTFLib.dll : fatal error LNK1120: 1 unresolved externals [C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\Tools\TestWebKitAPI\TestWTFLib.vcxproj]

<https://webkit-queues.webkit.org/results/10860637>
Comment 6 David Kilzer (:ddkilzer) 2019-01-23 11:38:45 PST
Created attachment 359914 [details]
Patch v2 (test Windows build fix)
Comment 7 David Kilzer (:ddkilzer) 2019-01-23 13:10:53 PST
(In reply to David Kilzer (:ddkilzer) from comment #6)
> Created attachment 359914 [details]
> Patch v2 (test Windows build fix)

Okay, maybe define it in BOTH places?!

C:\cygwin\home\buildbot\WebKit\Source\WTF\wtf\ASCIICType.cpp(30): error C2370: 'WTF::asciiCaseFoldTable': redefinition; different storage class [C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\Source\WTF\wtf\WTF.vcxproj]
  c:\cygwin\home\buildbot\webkit\source\wtf\wtf\ASCIICType.h(73): note: see declaration of 'WTF::asciiCaseFoldTable'
  Generating ../../DerivedSources/ForwardingHeaders/WebCore/Rect.h

<https://webkit-queues.webkit.org/results/10862438>
Comment 8 David Kilzer (:ddkilzer) 2019-01-23 13:31:59 PST
Created attachment 359938 [details]
Patch v3 (test Windows build fix again)
Comment 9 David Kilzer (:ddkilzer) 2019-01-23 17:44:54 PST
(In reply to David Kilzer (:ddkilzer) from comment #8)
> Created attachment 359938 [details]
> Patch v3 (test Windows build fix again)

Maybe TestWTFLib.dll, TestWebCoreLib.dll and WebKit.dll need to link to JavaScriptCore.dll?

<https://webkit-queues.webkit.org/results/10864285>
Comment 10 David Kilzer (:ddkilzer) 2019-01-23 19:29:35 PST
Created attachment 359987 [details]
Patch v4 (test Windows build fix #3)
Comment 11 David Kilzer (:ddkilzer) 2019-01-23 21:44:02 PST
(In reply to David Kilzer (:ddkilzer) from comment #9)
> (In reply to David Kilzer (:ddkilzer) from comment #8)
> > Created attachment 359938 [details]
> > Patch v3 (test Windows build fix again)
> 
> Maybe TestWTFLib.dll, TestWebCoreLib.dll and WebKit.dll need to link to
> JavaScriptCore.dll?
> 
> <https://webkit-queues.webkit.org/results/10864285>

Just had to use WTF_EXPORT_PRIVATE instead of WTF_EXPORT.
Comment 12 David Kilzer (:ddkilzer) 2019-01-24 02:40:11 PST
Committed r240429: <https://trac.webkit.org/changeset/240429>