60855b15 master: weston is not LTO ready
When code is build with LTO optimisation build fails with:
[1/67] Generating git-version.h with a custom command
fatal: No names found, cannot describe anything.
[2/2] Linking target tests/test-ivi-layout.so
FAILED: tests/test-ivi-layout.so
/usr/bin/gcc -o tests/test-ivi-layout.so tests/test-ivi-layout.so.p/meson-generated_.._.._protocol_weston-test-protocol.c.o tests/test-ivi-layout.so.p/ivi-layout-test-plugin.c.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,test-ivi-layout.so -Wl,-z,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none '-Wl,-rpath,$ORIGIN/../libweston:$ORIGIN/../compositor' -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/weston-9.0.0/x86_64-redhat-linux-gnu/libweston -Wl,-rpath-link,/home/tkloczko/rpmbuild/BUILD/weston-9.0.0/x86_64-redhat-linux-gnu/compositor libweston/libweston-10.so.0.0.0 compositor/libexec_weston.so.0.0.0 /usr/lib64/libwayland-server.so /usr/lib64/libpixman-1.so /usr/lib64/libxkbcommon.so -Wl,--end-group
/usr/bin/ld: /tmp/cccjIhG6.lto.o: in function `runner_run_handler':
/home/tkloczko/rpmbuild/BUILD/weston-9.0.0/x86_64-redhat-linux-gnu/../tests/ivi-layout-test-plugin.c:72: undefined reference to `__start_plugin_test_section'
/usr/bin/ld: /home/tkloczko/rpmbuild/BUILD/weston-9.0.0/x86_64-redhat-linux-gnu/../tests/ivi-layout-test-plugin.c:72: undefined reference to `__stop_plugin_test_section'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
To reproduce that issue please use below script:
CFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none";
CXXFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong --m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none";
LDFLAGS="-Wl,-z,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -flto=auto -flto-partition=none -fuse-linker-plugin";
CC="/usr/bin/gcc"; CXX="/usr/bin/g++"; FC="/usr/bin/gfortran";
AR="/usr/bin/gcc-ar"; NM="/usr/bin/gcc-nm"; RANLIB="/usr/bin/gcc-ranlib";
export CFLAGS CXXFLAGS FFLAGS FCFLAGS LDFLAGS CC CXX FC AR NM RANLIB;
/usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled . x86_64-redhat-linux-gnu \
-D backend-default=drm \
-D backend-drme=true \
-D backend-drm-screencast-vaapie=true \
-D backend-fbdeve=true \
-D backend-headlesse=true \
-D backend-rdpe=true \
-D backend-waylande=true \
-D backend-x11e=true \
-D color-management-colorde=true \
-D color-management-lcmse=true \
-D desktop-shell-client-default='weston-desktop-shell' \
-D doc=true \
-D image-jpege=true \
-D image-webpe=true \
-D launcher-loginde=true \
-D pipewiree=false \
-D remotinge=true \
-D renderer-gle=true \
-D resize-poole=true \
-D screensharee=true \
-D shell-desktope=true \
-D shell-fullscreene=true \
-D shell-ivie=true \
-D simple-clients=all \
-D systemde=true \
-D test-junit-xml=true \
-D tools=calibrator,debug,info,terminal,touch-calibrator \
-D wcap-decode=true \
-D weston-launche=true \
-D xwaylande=true \
/usr/bin/meson compile -C x86_64-redhat-linux-gnu -j 48 --verbose