Re: [E-devel] Elementary QuickLaunch and PIE executables
On Mon, 4 Nov 2013 15:48:19 +0900 Jean-Philippe André j...@videolan.org said: +1 Hello, TL;DR: I want to get rid of the quicklaunch complex wrapper + lib system and compile apps with -fPIC and link with -pie instead. Little to no changes required in elementary. As was pointed out recentely on this very mailing list, it is possible to make .so files that are runnable. The mail pointed to: http://rachid.koucha.free.fr/tech_corner/executable_lib.html This is IMO a pretty hacky solution (especially the part where we need to point directly to ld-linux-2.so). It's not very portable as it already won't run on x64 (need to change the ld library path). Also, I could not manage to get proper argc, argv in main (only the program name). Instead of that, we can compile apps with -fPIC (or -fpic or -fpie or -fPIE) and link with -pie. This will make linkable executables, instead of executable shared libraries :) Now, as you know, we have this Quicklaunch system that will load a library containing the application's code and run elm_main from there. The associated executable is then just a wrapper linked to that library and that calls elm_quicklaunch_fallback(). I see a few drawbacks to this model: - Compilation requires to take care of Quicklaunch, enabling #define flags as well as adding specific instructions in Makefiles to generate the lib and wrapper. - A program needs to be installed in order to be run by elementary_run (looks into ../lib folder) - There are two files instead of one (lib + wrapper) All of this seems a bit confusing to me, especially considering it is pretty easy to render an executable linkable by dlopen/dlsym, by using -fpie and -pie. I believe we can consider the performance hit minimal in normal use cases. For legacy support, we need to keep some stuff around, but I believe we should get rid of -DELM_LIB_QUICKLAUNCH and advise to compile PIE instead. Should we go as far as adding a #warning if ELM_LIB_QUICKLAUNCH is defined? :) Best regards, -- Jean-Philippe André -- Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951iu=/4140/ostg.clktrk ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel -- - Codito, ergo sum - I code, therefore I am -- The Rasterman (Carsten Haitzler)ras...@rasterman.com -- November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Elementary QuickLaunch and PIE executables
very nice On Monday 04 November 2013 15:48, Jean-Philippe André wrote : Hello, TL;DR: I want to get rid of the quicklaunch complex wrapper + lib system and compile apps with -fPIC and link with -pie instead. Little to no changes required in elementary. -- November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Elementary QuickLaunch and PIE executables
Guys! This speed-up is SIDE effect of my changes :-P Glad it's making your lives easier though :) 2013/11/7 Jérémy Zurcher jer...@asynk.ch very nice On Monday 04 November 2013 15:48, Jean-Philippe André wrote : Hello, TL;DR: I want to get rid of the quicklaunch complex wrapper + lib system and compile apps with -fPIC and link with -pie instead. Little to no changes required in elementary. -- November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel -- Jean-Philippe André -- November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Elementary QuickLaunch and PIE executables
On Fri, 8 Nov 2013 10:40:42 +0900 Jean-Philippe André j...@videolan.org said: Guys! This speed-up is SIDE effect of my changes :-P Glad it's making your lives easier though :) for some people... that's all that matters :) 2013/11/7 Jérémy Zurcher jer...@asynk.ch very nice On Monday 04 November 2013 15:48, Jean-Philippe André wrote : Hello, TL;DR: I want to get rid of the quicklaunch complex wrapper + lib system and compile apps with -fPIC and link with -pie instead. Little to no changes required in elementary. -- November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel -- Jean-Philippe André -- November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel -- - Codito, ergo sum - I code, therefore I am -- The Rasterman (Carsten Haitzler)ras...@rasterman.com -- November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Elementary QuickLaunch and PIE executables
From: j...@videolan.org Date: Fri, 8 Nov 2013 10:40:42 +0900 To: enlightenment-devel@lists.sourceforge.net Subject: Re: [E-devel] Elementary QuickLaunch and PIE executables Guys! This speed-up is SIDE effect of my changes :-P Glad it's making your lives easier though :) And Viagra was originally developed for high blood pressure and angina. Sometimes side effects are more important. :) -- November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Elementary QuickLaunch and PIE executables
Hello. On Mon, 2013-11-04 at 17:37, Jean-Philippe André wrote: I have submitted some changes to Elementary, reviewed by Cedric, so blame him if everything is broken now :) The following commits remove elementary_testql, simplify the build logic based on PIE and even simplify execution of quicklaunch programs (by extending the searched paths): https://git.enlightenment.org/core/elementary.git/commit/?id=876f8bccc7fed2f8511c9bdbe1c0e21be30290ca https://git.enlightenment.org/core/elementary.git/commit/?id=97264f434d88af38aead65426d67236c7f89ffc0 I'll remove the now useless #ifdef ELM_LIB_QUICKLAUNCH in elementary. Btw, I forgot to add that the linker needs -rdynamic -pie and not just -pie :) The speed up for the build is really nice. Thanks for doing it. regards Stefan Schmidt -- November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Elementary QuickLaunch and PIE executables
Hello again, I have submitted some changes to Elementary, reviewed by Cedric, so blame him if everything is broken now :) The following commits remove elementary_testql, simplify the build logic based on PIE and even simplify execution of quicklaunch programs (by extending the searched paths): https://git.enlightenment.org/core/elementary.git/commit/?id=876f8bccc7fed2f8511c9bdbe1c0e21be30290ca https://git.enlightenment.org/core/elementary.git/commit/?id=97264f434d88af38aead65426d67236c7f89ffc0 I'll remove the now useless #ifdef ELM_LIB_QUICKLAUNCH in elementary. Btw, I forgot to add that the linker needs -rdynamic -pie and not just -pie :) Best regards, 2013/11/4 Jean-Philippe André j...@videolan.org Hello, TL;DR: I want to get rid of the quicklaunch complex wrapper + lib system and compile apps with -fPIC and link with -pie instead. Little to no changes required in elementary. As was pointed out recentely on this very mailing list, it is possible to make .so files that are runnable. The mail pointed to: http://rachid.koucha.free.fr/tech_corner/executable_lib.html This is IMO a pretty hacky solution (especially the part where we need to point directly to ld-linux-2.so). It's not very portable as it already won't run on x64 (need to change the ld library path). Also, I could not manage to get proper argc, argv in main (only the program name). Instead of that, we can compile apps with -fPIC (or -fpic or -fpie or -fPIE) and link with -pie. This will make linkable executables, instead of executable shared libraries :) Now, as you know, we have this Quicklaunch system that will load a library containing the application's code and run elm_main from there. The associated executable is then just a wrapper linked to that library and that calls elm_quicklaunch_fallback(). I see a few drawbacks to this model: - Compilation requires to take care of Quicklaunch, enabling #define flags as well as adding specific instructions in Makefiles to generate the lib and wrapper. - A program needs to be installed in order to be run by elementary_run (looks into ../lib folder) - There are two files instead of one (lib + wrapper) All of this seems a bit confusing to me, especially considering it is pretty easy to render an executable linkable by dlopen/dlsym, by using -fpie and -pie. I believe we can consider the performance hit minimal in normal use cases. For legacy support, we need to keep some stuff around, but I believe we should get rid of -DELM_LIB_QUICKLAUNCH and advise to compile PIE instead. Should we go as far as adding a #warning if ELM_LIB_QUICKLAUNCH is defined? :) Best regards, -- Jean-Philippe André -- Jean-Philippe André -- Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951iu=/4140/ostg.clktrk ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel