<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>270902</bug_id>
          
          <creation_ts>2024-03-13 02:37:13 -0700</creation_ts>
          <short_desc>[GTK][WPE] Build removing unused sections when supported</short_desc>
          <delta_ts>2024-03-27 01:52:52 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WPE WebKit</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>271737</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Miguel Gomez">magomez</reporter>
          <assigned_to name="Miguel Gomez">magomez</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>mcatanzaro</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2020670</commentid>
    <comment_count>0</comment_count>
    <who name="Miguel Gomez">magomez</who>
    <bug_when>2024-03-13 02:37:13 -0700</bug_when>
    <thetext>There are situations in constrained environments where the disk space is really small. In those situations it&apos;s interesting that we try to reduce the binary size as much as possible by passing appropriate flags to the compiler.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2020718</commentid>
    <comment_count>1</comment_count>
    <who name="Miguel Gomez">magomez</who>
    <bug_when>2024-03-13 08:18:47 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/25819</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2020719</commentid>
    <comment_count>2</comment_count>
    <who name="Miguel Gomez">magomez</who>
    <bug_when>2024-03-13 08:24:34 -0700</bug_when>
    <thetext>Building with the proposed optimizations in the PR is broken due to this error:

In file included from /app/webkit/Source/WebCore/platform/MediaCapabilitiesDecodingInfo.h:29,
                 from /app/webkit/Source/WebCore/platform/mediastream/gstreamer/GStreamerWebRTCProvider.cpp:28,
                 from /app/webkit/WebKitBuild/WPE/Release/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-65.cpp:7:
In copy constructor ‘constexpr WebCore::MediaDecodingConfiguration::MediaDecodingConfiguration(const WebCore::MediaDecodingConfiguration&amp;)’,
    inlined from ‘constexpr WebCore::MediaCapabilitiesDecodingInfo::MediaCapabilitiesDecodingInfo(const WebCore::MediaCapabilitiesDecodingInfo&amp;)’ at /app/webkit/Source/WebCore/platform/MediaCapabilitiesDecodingInfo.h:33:8,
    inlined from ‘constexpr std::_Optional_payload_base&lt;_Tp&gt;::_Storage&lt;_Up, false&gt;::_Storage(std::in_place_t, _Args&amp;&amp; ...) [with _Args = {WebCore::MediaCapabilitiesDecodingInfo&amp;}; _Up = WebCore::MediaCapabilitiesDecodingInfo; _Tp = WebCore::MediaCapabilitiesDecodingInfo]’ at /usr/include/c++/13.2.0/optional:244:8,
    inlined from ‘constexpr std::_Optional_payload_base&lt;_Tp&gt;::_Optional_payload_base(std::in_place_t, _Args&amp;&amp; ...) [with _Args = {WebCore::MediaCapabilitiesDecodingInfo&amp;}; _Tp = WebCore::MediaCapabilitiesDecodingInfo]’ at /usr/include/c++/13.2.0/optional:126:4,
    inlined from ‘constexpr std::_Optional_payload&lt;WebCore::MediaCapabilitiesDecodingInfo, true, false, false&gt;::_Optional_payload(std::in_place_t, _Args&amp;&amp; ...) [with _Args = {WebCore::MediaCapabilitiesDecodingInfo&amp;}][inherited from std::_Optional_payload_base&lt;WebCore::MediaCapabilitiesDecodingInfo&gt;]’ at /usr/include/c++/13.2.0/optional:397:42,
    inlined from ‘constexpr std::_Optional_payload&lt;WebCore::MediaCapabilitiesDecodingInfo, false, false, false&gt;::_Optional_payload(std::in_place_t, _Args&amp;&amp; ...) [with _Args = {WebCore::MediaCapabilitiesDecodingInfo&amp;}][inherited from std::_Optional_payload_base&lt;WebCore::MediaCapabilitiesDecodingInfo&gt;]’ at /usr/include/c++/13.2.0/optional:431:57,
    inlined from ‘constexpr std::_Optional_base&lt;_Tp, &lt;anonymous&gt;, &lt;anonymous&gt; &gt;::_Optional_base(std::in_place_t, _Args&amp;&amp; ...) [with _Args = {WebCore::MediaCapabilitiesDecodingInfo&amp;}; typename std::enable_if&lt;is_constructible_v&lt;_Tp, _Args ...&gt;, bool&gt;::type &lt;anonymous&gt; = false; _Tp = WebCore::MediaCapabilitiesDecodingInfo; bool &lt;anonymous&gt; = false; bool &lt;anonymous&gt; = false]’ at /usr/include/c++/13.2.0/optional:521:4,
    inlined from ‘constexpr std::optional&lt;_Tp&gt;::optional(_Up&amp;&amp;) [with _Up = WebCore::MediaCapabilitiesDecodingInfo&amp;; typename std::enable_if&lt;__and_v&lt;std::__not_&lt;std::is_same&lt;std::optional&lt;_Tp&gt;, typename std::remove_cv&lt;typename std::remove_reference&lt;_Iter&gt;::type&gt;::type&gt; &gt;, std::__not_&lt;std::is_same&lt;std::in_place_t, typename std::remove_cv&lt;typename std::remove_reference&lt;_Iter&gt;::type&gt;::type&gt; &gt;, std::is_constructible&lt;_Tp, _Up&gt;, std::is_convertible&lt;_Iter, _Iterator&gt; &gt;, bool&gt;::type &lt;anonymous&gt; = true; _Tp = WebCore::MediaCapabilitiesDecodingInfo]’ at /usr/include/c++/13.2.0/optional:749:47,
    inlined from ‘virtual std::optional&lt;WebCore::MediaCapabilitiesDecodingInfo&gt; WebCore::GStreamerWebRTCProvider::videoDecodingCapabilitiesOverride(const WebCore::VideoConfiguration&amp;)’ at /app/webkit/Source/WebCore/platform/mediastream/gstreamer/GStreamerWebRTCProvider.cpp:136:19:
/app/webkit/Source/WebCore/platform/mediacapabilities/MediaDecodingConfiguration.h:33:8: error: ‘info.WebCore::MediaCapabilitiesDecodingInfo::supportedConfiguration.WebCore::MediaDecodingConfiguration::type’ is used uninitialized [-Werror=uninitialized]
   33 | struct MediaDecodingConfiguration : MediaConfiguration {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~
/app/webkit/Source/WebCore/platform/mediastream/gstreamer/GStreamerWebRTCProvider.cpp: In member function ‘virtual std::optional&lt;WebCore::MediaCapabilitiesDecodingInfo&gt; WebCore::GStreamerWebRTCProvider::videoDecodingCapabilitiesOverride(const WebCore::VideoConfiguration&amp;)’:
/app/webkit/Source/WebCore/platform/mediastream/gstreamer/GStreamerWebRTCProvider.cpp:120:35: note: ‘info’ declared here
  120 |     MediaCapabilitiesDecodingInfo info;
      |                                   ^~~~
cc1plus: all warnings being treated as errors


The error doesn&apos;t happen with the optimizations disabled. I&apos;ve tested that this is because of the -finline-limit=90 option. The error is about a member of a struct that&apos;s not initialized when returning a copy of a local struct in a function. It should happen without the optimizations as well, but the compiler is probably inlining the problematic function, so this copy to return the local value doesn&apos;t happen and the warning is not triggered. When -finline-limit=90 is used, the function is not inlined and the error becomes visible. I&apos;ll send a fix for the warning once this PR lands.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2023911</commentid>
    <comment_count>3</comment_count>
    <who name="Miguel Gomez">magomez</who>
    <bug_when>2024-03-26 07:32:18 -0700</bug_when>
    <thetext>I&apos;m reducing a bit the scope of this to only pass -ffunction-sections -fdata-sections to the compiler and --gc-sections to the linker when available.

This reduces the binary size while not causing a performance drop, so it makes sense to have them always enabled.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2023918</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2024-03-26 07:57:35 -0700</bug_when>
    <thetext>I&apos;m not familiar with these options, but gcc(1) says:

           Only  use  these  options  when there are significant benefits from doing so.  When you specify these options, the assembler and linker create
           larger object and executable files and are also slower.  These options affect code generation.  They prevent optimizations by the compiler and
           assembler using relative locations inside a translation unit since the locations  are  unknown  until  link  time.   An  example  of  such  an
           optimization is relaxing calls to short call instructions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2024120</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-03-27 01:52:49 -0700</bug_when>
    <thetext>Committed 276726@main (8603570132a8): &lt;https://commits.webkit.org/276726@main&gt;

Reviewed commits have been landed. Closing PR #25819 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>