[openjfx11] Review request for 8203294: [Linux] Link libgcc and libstdc++ statically to support gcc-7.x

Arunprasad Rajkumar arunprasad.rajkumar at oracle.com
Tue May 22 05:28:13 UTC 2018


Hi,

Please review the following fix: 

http://cr.openjdk.java.net/~arajkumar/8203294/webrev 

Root cause: 
Currently C and C++ standard libraries are linked dynamically(except javafx.web), it may restrict the usage of javafx on old Linux distros when we upgrade to latest compiler(GCC 7.3?) 

Solution: 
Fix all javafx module dynamic library linking process to use '-static-libgcc -static-libstdc++' flags to force the static linking of standard libs. Additionally '-ffunction-sections -fdata-sections' GCC compiler flags[1] are used to reduce the library size due to static linking.

Testing: 
Used the following command to see the size difference of javafx libraries with and without static linking 
```` 
find build/modular-sdk/modules_libs/ -type f -name *.so -exec ls -lh {} \; -exec sh -c 'ls -lh $JAVA_HOME/lib/$(basename {})' \; 
```` 

Used the following command to verify the fix, 
```` 
find build/modular-sdk/modules_libs -name *.so -exec sh -c "readelf -d {} | egrep 'libgcc|libstdc++' > /dev/null && echo {}" \; 
```` 

[1] https://gcc.gnu.org/onlinedocs/gnat_ugn/Compilation-options.html

Thanks,
Arun


More information about the openjfx-dev mailing list