[gjs] build: Add -fno-semantic-interposition to -Bsymbolic-functions



commit d23462963247d6765ad7c19f1eb0f4f84cda9e22
Author: Jan Alexander Steffens (heftig) <jan steffens gmail com>
Date:   Thu Feb 13 19:09:10 2020 +0000

    build: Add -fno-semantic-interposition to -Bsymbolic-functions
    
    -Bsymbolic-functions prevents internal calls to our exported functions
    from being interposed, which removes one (GOT) or two (PLT) layers of
    indirection. However, this flag applies during the linking stage, after
    compilation and optimization has already happened, so the compiler isn't
    able to optimize these calls like calls to static functions.
    
    -fno-semantic-interposition tells the compiler that, if interposition
    happens, the interposed symbols are semantically indistinguishable
    from the original ones. This lets it apply optimization like inlining to
    our calls.
    
    Closes https://gitlab.gnome.org/GNOME/gjs/issues/303

 meson.build | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/meson.build b/meson.build
index d9a81721..175ace69 100644
--- a/meson.build
+++ b/meson.build
@@ -60,6 +60,12 @@ else
 -Dbsymbolic_functions=false''')
         endif
         add_project_link_arguments('-Bsymbolic-functions', language: ['cpp', 'c'])
+        if cc.has_argument('-fno-semantic-interposition')
+            add_project_arguments('-fno-semantic-interposition', language: 'c')
+        endif
+        if cxx.has_argument('-fno-semantic-interposition')
+            add_project_arguments('-fno-semantic-interposition', language: 'cpp')
+        endif
     endif
 endif
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]