<?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>180625</bug_id>
          
          <creation_ts>2017-12-09 13:26:32 -0800</creation_ts>
          <short_desc>Link-Time-Optimizations could be used</short_desc>
          <delta_ts>2022-02-28 15:08:20 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>WebKit Local Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Walter Hüttenmeyer">walter.huettenmeyer</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>annulen</cc>
    
    <cc>aperez</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>tzagallo</cc>
    
    <cc>walter.huettenmeyer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1380003</commentid>
    <comment_count>0</comment_count>
      <attachid>328914</attachid>
    <who name="Walter Hüttenmeyer">walter.huettenmeyer</who>
    <bug_when>2017-12-09 13:26:32 -0800</bug_when>
    <thetext>Created attachment 328914
Patch to allow LTO

Compiling webkitgtk+-2.18.3 locally on an AMD64 machine, it will fail when using --flto=x --fuse-linker-plugin.
Only way to compile it without errors was to disable LTO.

I found a small patch on the gentoo forums here: https://forums.gentoo.org/viewtopic-t-1052716-start-0.html (credits to user costel78).
Patching the source with this allows me to compile it fine with LTO enabled.

Could you include this in upstream, if it seems worth?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521673</commentid>
    <comment_count>1</comment_count>
    <who name="Konstantin Tokarev">annulen</who>
    <bug_when>2019-03-27 07:18:26 -0700</bug_when>
    <thetext>FWIW, Mac port uses clang&apos;s ThinLTO since r243396</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1549689</commentid>
    <comment_count>2</comment_count>
    <who name="Walter Hüttenmeyer">walter.huettenmeyer</who>
    <bug_when>2019-07-02 13:04:54 -0700</bug_when>
    <thetext>Hi Konstantin,

thank you for the info. On Linux it still won&apos;t compile with &quot;-flto=n&quot;
the attached patch does do the magic.

I do not know if any of the changes are in the correct and appropriate sections,
and even it&apos;s not included a statement like &quot;well, you could do that without harming much&quot; may do to include it in the gentoo tree until you decide on what to do with the patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1549690</commentid>
    <comment_count>3</comment_count>
      <attachid>373354</attachid>
    <who name="Walter Hüttenmeyer">walter.huettenmeyer</who>
    <bug_when>2019-07-02 13:07:24 -0700</bug_when>
    <thetext>Created attachment 373354
Patch to allow -flto=n; tested against webkit-gtk-2.24.2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1549692</commentid>
    <comment_count>4</comment_count>
      <attachid>373354</attachid>
    <who name="Konstantin Tokarev">annulen</who>
    <bug_when>2019-07-02 13:16:57 -0700</bug_when>
    <thetext>Comment on attachment 373354
Patch to allow -flto=n; tested against webkit-gtk-2.24.2

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

&gt; b/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp   2016-01-14 21:25:52.000000000 +0100:30
&gt; +#if __GNUC__ &gt;= 5

We require GCC 7 now so this check is redundant</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1846798</commentid>
    <comment_count>5</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2022-02-28 15:05:12 -0800</bug_when>
    <thetext>LTO has always worked fine for me without this patch. For the sake of
being thorough, I just did a build using the following command for
configuring it:

  CC=gcc CXX=g++ \
  LDFLAGS=&apos;-flto=27 -fuse-linker-plugin -fuse-ld=bfd&apos; \
  CFLAGS=&apos;-flto=27 -fuse-linker-plugin&apos; \
  CXX=&apos;g++ -flto=27 -fuse-linker-plugin&apos; \
  cmake -S. -Bbuild-gtk -DCMAKE_BUILD_TYPE=Release -DPORT=GTK -GNinja &amp;&amp; \
  ninja -Cbuild-gtk -j27

This completed just fine :)

I am going to close this as WORKSFORME, but if somebody runs into the
same issue again of course we can reopen it. In that case, please do
indicate how to reproduce the build issue (commands used for building,
and information about the compiler/linker/etc. being used).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1846800</commentid>
    <comment_count>6</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2022-02-28 15:07:51 -0800</bug_when>
    <thetext>For the record, I also tried Clang/LLD with -flto=thin/-fuse-ld=lld
and WebKitGTK built fine as well. Compiler versions here were:

  % gcc -dumpversion                                                  
  11.2.0
  % clang -dumpversion                                            
  13.0.1</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>328914</attachid>
            <date>2017-12-09 13:26:32 -0800</date>
            <delta_ts>2019-07-02 13:07:24 -0700</delta_ts>
            <desc>Patch to allow LTO</desc>
            <filename>webkit-lto.patch</filename>
            <type>text/plain</type>
            <size>743</size>
            <attacher name="Walter Hüttenmeyer">walter.huettenmeyer</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9sbGludC9Mb3dMZXZlbEludGVycHJl
dGVyLmNwcCBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9sbGludC9Mb3dMZXZlbEludGVycHJldGVy
LmNwcCAKLS0tIGEvU291cmNlL0phdmFTY3JpcHRDb3JlL2xsaW50L0xvd0xldmVsSW50ZXJwcmV0
ZXIuY3BwICAgMjAxNi0wMS0xNCAyMToyMDo0Mi4zMDQ5MDI5MDUgKzAxMDAgCisrKyBiL1NvdXJj
ZS9KYXZhU2NyaXB0Q29yZS9sbGludC9Mb3dMZXZlbEludGVycHJldGVyLmNwcCAgIDIwMTYtMDEt
MTQgMjE6MjU6NTIuMDAwMDAwMDAwICswMTAwIApAQCAtMjMsNiArMjMsMTUgQEAgCiAgKiBPRiBU
SElTIFNPRlRXQVJFLCBFVkVOIElGIEFEVklTRUQgT0YgVEhFIFBPU1NJQklMSVRZIE9GIFNVQ0gg
REFNQUdFLiAKICAqLyAKICAKKy8vIElmIHdlIGFyZSB1c2luZyBnY2MgPj0gNS4wLCBtYWtlIHN1
cmUgdGhhdCB0aGlzIGNvbXBpbGF0aW9uIHVuaXQgaXMgCisvLyBjb21waWxlZCB3aXRoIC1mbm8t
bHRvLCBiZWNhdXNlIHdlIG1heSBiZSB1c2luZyBpbmxpbmUgYXNzZW1ibHkgCisvLyBpbmNsdWRl
ZCBmcm9tIExMSW50QXNzZW1ibHkuaCAKKyNpZmRlZiBfX0dOVUNfXyAKKyNpZiBfX0dOVUNfXyA+
PSA1IAorI3ByYWdtYSBHQ0Mgb3B0aW1pemUgKCJuby1sdG8iKSAKKyNlbmRpZiAKKyNlbmRpZiAK
KyAKICNpbmNsdWRlICJjb25maWcuaCIgCiAjaW5jbHVkZSAiTG93TGV2ZWxJbnRlcnByZXRlci5o
Igo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>373354</attachid>
            <date>2019-07-02 13:07:24 -0700</date>
            <delta_ts>2022-02-28 15:08:20 -0800</delta_ts>
            <desc>Patch to allow -flto=n; tested against webkit-gtk-2.24.2</desc>
            <filename>lto.patch</filename>
            <type>text/plain</type>
            <size>607</size>
            <attacher name="Walter Hüttenmeyer">walter.huettenmeyer</attacher>
            
              <data encoding="base64">LS0tIGEvU291cmNlL0phdmFTY3JpcHRDb3JlL2xsaW50L0xvd0xldmVsSW50ZXJwcmV0ZXIuY3Bw
ICAgMjAxNi0wMS0xNCAyMToyMDo0Mi4zMDQ5MDI5MDUgKzAxMDAKKysrIGIvU291cmNlL0phdmFT
Y3JpcHRDb3JlL2xsaW50L0xvd0xldmVsSW50ZXJwcmV0ZXIuY3BwICAgMjAxNi0wMS0xNCAyMToy
NTo1Mi4wMDAwMDAwMDAgKzAxMDAKQEAgLTIzLDYgKzIzLDE1IEBACiAgKiBPRiBUSElTIFNPRlRX
QVJFLCBFVkVOIElGIEFEVklTRUQgT0YgVEhFIFBPU1NJQklMSVRZIE9GIFNVQ0ggREFNQUdFLgog
ICovCiAKKy8vIElmIHdlIGFyZSB1c2luZyBnY2MgPj0gNS4wLCBtYWtlIHN1cmUgdGhhdCB0aGlz
IGNvbXBpbGF0aW9uIHVuaXQgaXMKKy8vIGNvbXBpbGVkIHdpdGggLWZuby1sdG8sIGJlY2F1c2Ug
d2UgbWF5IGJlIHVzaW5nIGlubGluZSBhc3NlbWJseQorLy8gaW5jbHVkZWQgZnJvbSBMTEludEFz
c2VtYmx5LmgKKyNpZmRlZiBfX0dOVUNfXworI2lmIF9fR05VQ19fID49IDUKKyNwcmFnbWEgR0ND
IG9wdGltaXplICgibm8tbHRvIikKKyNlbmRpZgorI2VuZGlmCisKICNpbmNsdWRlICJjb25maWcu
aCIKICNpbmNsdWRlICJMb3dMZXZlbEludGVycHJldGVyLmgiCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>