Bug 222860 - [WPE] Reenable -fvisibility=hidden and -fvisibility-inlines-hidden
Summary: [WPE] Reenable -fvisibility=hidden and -fvisibility-inlines-hidden
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WPE WebKit (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on: 231430 231446 231735
Blocks:
  Show dependency treegraph
 
Reported: 2021-03-06 06:33 PST by Michael Catanzaro
Modified: 2021-10-20 06:14 PDT (History)
12 users (show)

See Also:


Attachments
Patch (1.31 KB, patch)
2021-10-07 10:17 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff
Patch (12.64 KB, patch)
2021-10-08 07:16 PDT, Philippe Normand
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (5.60 KB, patch)
2021-10-15 03:20 PDT, Carlos Garcia Campos
don.olmstead: review+
Details | Formatted Diff | Diff
Patch for landing (6.75 KB, patch)
2021-10-20 02:42 PDT, Carlos Garcia Campos
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (7.70 KB, patch)
2021-10-20 05:34 PDT, Carlos Garcia Campos
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-03-06 06:33:44 PST
This is a follow-up from bug #181916. We should just need to add this to OptionsWPE.cmake:

set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

But first we need to add more exports until it builds. E.g. the entire QtWPE API is not exported.
Comment 1 Philippe Normand 2021-03-09 12:15:20 PST
WDYT Adrian?
Comment 2 Michael Catanzaro 2021-10-01 13:37:16 PDT
In https://bugs.webkit.org/show_bug.cgi?id=181916#c58 Carlos Lopez found that -fvisibility=hidden resulted in a major performance improvement for GTK. I would expect similar improvement for WPE.

WPE used to use -fvisibility=hidden until I removed it stupidly in r224642. I assumed it was redundant with using a linker version script, but in fact we really want both. Sorry about that.
Comment 3 Michael Catanzaro 2021-10-07 10:16:16 PDT
(In reply to Michael Catanzaro from comment #0)
> But first we need to add more exports until it builds. E.g. the entire QtWPE
> API is not exported.

I'm not sure that's true anymore, I see some classes are exported now. Anyway, I failed to build QtWPE due to bug #231369. The rest of WPE build successfully. Let's see if the EWS is happy.
Comment 4 Michael Catanzaro 2021-10-07 10:17:17 PDT
Created attachment 440506 [details]
Patch
Comment 5 Michael Catanzaro 2021-10-07 10:53:38 PDT
Comment on attachment 440506 [details]
Patch

Looks like the QtWPE API does indeed need more work.
Comment 6 Philippe Normand 2021-10-07 13:38:46 PDT
Naive build fix: http://sprunge.us/pYbFZg
Comment 7 Michael Catanzaro 2021-10-07 13:55:36 PDT
(In reply to Philippe Normand from comment #6)
> Naive build fix: http://sprunge.us/pYbFZg

Cool, thanks.

Except WPEQtViewLoadRequest.h is public API, so we can't use WebKit internals there. That will break the public headers since WKDeclarationSpecifiers.h is not installed. Looks like we should use Q_DECL_EXPORT there.
Comment 8 Michael Catanzaro 2021-10-07 13:58:38 PDT
(In reply to Michael Catanzaro from comment #7)
> Except WPEQtViewLoadRequest.h is public API, so we can't use WebKit
> internals there. That will break the public headers since
> WKDeclarationSpecifiers.h is not installed. Looks like we should use
> Q_DECL_EXPORT there.

Wait, WPEQtView.h is public too, of course, so we should use Q_DECL_EXPORT there too. But that header is actually already using GRefPtr.h. How is that possible? GRefPtr.h is not a public header and should not be installed, but WPEQtView.h is installed. ?????????
Comment 9 Philippe Normand 2021-10-08 06:59:07 PDT
(In reply to Michael Catanzaro from comment #7)
> (In reply to Philippe Normand from comment #6)
> > Naive build fix: http://sprunge.us/pYbFZg
> 
> Cool, thanks.
> 
> Except WPEQtViewLoadRequest.h is public API, so we can't use WebKit
> internals there. That will break the public headers since
> WKDeclarationSpecifiers.h is not installed. Looks like we should use
> Q_DECL_EXPORT there.

Good point!

(In reply to Michael Catanzaro from comment #8)
> (In reply to Michael Catanzaro from comment #7)
> > Except WPEQtViewLoadRequest.h is public API, so we can't use WebKit
> > internals there. That will break the public headers since
> > WKDeclarationSpecifiers.h is not installed. Looks like we should use
> > Q_DECL_EXPORT there.
> 
> Wait, WPEQtView.h is public too, of course, so we should use Q_DECL_EXPORT
> there too. But that header is actually already using GRefPtr.h. How is that
> possible? GRefPtr.h is not a public header and should not be installed, but
> WPEQtView.h is installed. ?????????

I think that means no one tried to use this API. The couple folks I heard from were using the QML modules, not the C++ API.
Comment 10 Philippe Normand 2021-10-08 07:16:31 PDT
Created attachment 440603 [details]
Patch
Comment 11 Michael Catanzaro 2021-10-08 07:30:46 PDT
Comment on attachment 440603 [details]
Patch

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

> Source/cmake/OptionsWPE.cmake:151
> +set(CMAKE_C_VISIBILITY_PRESET hidden)
> +set(CMAKE_CXX_VISIBILITY_PRESET hidden)
> +set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

Let's land this in two steps:

 (1) Everything except this portion of the diff, r=me
 (2) This part, in a second commit.

That way, we don't have to revert (1) if it turns out there is some problem caused by (2).
Comment 12 Philippe Normand 2021-10-08 07:38:58 PDT
Alright, I'll fork in a separate bug!
Comment 13 Philippe Normand 2021-10-08 07:44:11 PDT
(In reply to Philippe Normand from comment #12)
> Alright, I'll fork in a separate bug!

https://bugs.webkit.org/show_bug.cgi?id=231430
Comment 14 Michael Catanzaro 2021-10-08 12:09:59 PDT
So only remaining problem is we need to export WebKit::TextChecker::setContinuousSpellCheckingEnabled for WKTR, but for some reason this breaks the iOS build. It might be doing some sort of check to ensure that all exported symbols correspond to something in a public header, which is pretty strict.

Proposal: let's create and export WKTextCheckerSetContinuousSpellCheckingEnabled instead. It already exists on GTK, and we can easily add a WPE version.
Comment 15 Michael Catanzaro 2021-10-08 13:35:51 PDT
(In reply to Michael Catanzaro from comment #14)
> Proposal: let's create and export
> WKTextCheckerSetContinuousSpellCheckingEnabled instead. It already exists on
> GTK, and we can easily add a WPE version.

Bug #231446
Comment 16 EWS 2021-10-10 14:28:49 PDT
Committed r283878 (242755@main): <https://commits.webkit.org/242755@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 440506 [details].
Comment 17 WebKit Commit Bot 2021-10-14 05:28:01 PDT
Re-opened since this is blocked by bug 231735
Comment 18 Carlos Garcia Campos 2021-10-15 03:20:30 PDT
Created attachment 441358 [details]
Patch
Comment 19 Carlos Garcia Campos 2021-10-15 04:03:35 PDT
I ran speedometer after and before this patch:

score before: 118
score after: 139
Comment 20 Michael Catanzaro 2021-10-15 08:11:24 PDT
Comment on attachment 441358 [details]
Patch

This needs to be reviewed by Don. I suspect he's not going to like this because WEBKIT_FRAMEWORKS ought to be handling this.
Comment 21 Carlos Garcia Campos 2021-10-16 02:05:46 PDT
(In reply to Michael Catanzaro from comment #20)
> Comment on attachment 441358 [details]
> Patch
> 
> This needs to be reviewed by Don. I suspect he's not going to like this
> because WEBKIT_FRAMEWORKS ought to be handling this.

I did my best, but I don't understand CMake, I tried to use frameworks everywhere, but for some reason WebKitTestRunner_FRAMEWORKS didn't work, so I added JavaScriptCore directly to LIBRARIES since for WPE it's always built as object in this patch.
Comment 22 Carlos Garcia Campos 2021-10-19 02:47:13 PDT
(In reply to Michael Catanzaro from comment #20)
> Comment on attachment 441358 [details]
> Patch
> 
> This needs to be reviewed by Don. I suspect he's not going to like this
> because WEBKIT_FRAMEWORKS ought to be handling this.

Don? Could you review this, please?
Comment 23 Don Olmstead 2021-10-19 10:32:21 PDT
Comment on attachment 441358 [details]
Patch

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

LGTM with a couple potential nits.

> Source/WebKit/PlatformWPE.cmake:451
> +        $<TARGET_PROPERTY:JavaScriptCore,INCLUDE_DIRECTORIES>

I feel like you'd want something more specific for this. This means its getting ALL include directories from JavaScriptCore.

> Tools/WebKitTestRunner/PlatformWPE.cmake:30
> +    $<TARGET_OBJECTS:JavaScriptCore>
> +    $<TARGET_OBJECTS:bmalloc>

I'm surprised these are needed since WebKitTestRunner uses _FRAMEWORKS can you maybe double check this?

> Tools/WebKitTestRunner/PlatformWPE.cmake:40
> +    $<TARGET_OBJECTS:JavaScriptCore>
> +    $<TARGET_OBJECTS:bmalloc>

This one isn't surprising as the InjectedBundle stuff didn't get the _FRAMEWORKS treatment.
Comment 24 Carlos Garcia Campos 2021-10-20 01:37:50 PDT
(In reply to Don Olmstead from comment #23)
> Comment on attachment 441358 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=441358&action=review
> 
> LGTM with a couple potential nits.
> 
> > Source/WebKit/PlatformWPE.cmake:451
> > +        $<TARGET_PROPERTY:JavaScriptCore,INCLUDE_DIRECTORIES>
> 
> I feel like you'd want something more specific for this. This means its
> getting ALL include directories from JavaScriptCore.

I copy-pasted :-P I'll try to use something more specific.

> > Tools/WebKitTestRunner/PlatformWPE.cmake:30
> > +    $<TARGET_OBJECTS:JavaScriptCore>
> > +    $<TARGET_OBJECTS:bmalloc>
> 
> I'm surprised these are needed since WebKitTestRunner uses _FRAMEWORKS can
> you maybe double check this?

Yes, I tried everything and the only thing that worked was manually adding the libraries. I don't understand why.
 
> > Tools/WebKitTestRunner/PlatformWPE.cmake:40
> > +    $<TARGET_OBJECTS:JavaScriptCore>
> > +    $<TARGET_OBJECTS:bmalloc>
> 
> This one isn't surprising as the InjectedBundle stuff didn't get the
> _FRAMEWORKS treatment.
Comment 25 Carlos Garcia Campos 2021-10-20 02:42:33 PDT
Created attachment 441862 [details]
Patch for landing
Comment 26 Carlos Garcia Campos 2021-10-20 02:46:46 PDT
I managed to use FRAMEWORKS for WTR, it was indeed already used, but for some reason I had to remove WebKit and WebCoreTestSupport, I guess they aren't actually needed because they are already in TestRunnerShared lib
Comment 27 Carlos Garcia Campos 2021-10-20 05:34:31 PDT
Created attachment 441871 [details]
Patch for landing
Comment 28 Carlos Garcia Campos 2021-10-20 06:14:34 PDT
Committed r284527 (243269@main): <https://commits.webkit.org/243269@main>