diff mbox series

[v2,3/3] meson: Drop the .fa library prefix

Message ID 20240522-xkb-v2-3-67b54fa7c98f@daynix.com
State New
Headers show
Series Fix sanitizer errors with clang 18.1.1 | expand

Commit Message

Akihiko Odaki May 22, 2024, 10:43 a.m. UTC
The non-standard .fa library prefix breaks the link source
de-duplication done by Meson so drop it.

The lack of link source de-duplication causes AddressSanitizer to
complain ODR violations, and makes GNU ld abort when combined with
clang's LTO.

Previously, the non-standard prefix was necessary for fork-fuzzing.
Meson wraps all standard-prefixed libraries with --start-group and
--end-group. This made a fork-fuzz.ld linker script wrapped as well and
broke builds. Commit d2e6f9272d33 ("fuzz: remove fork-fuzzing
scaffolding") dropped fork-fuzzing so we can now restore the standard
prefix.

The occurances of the prefix was detected and removed by performing
a tree-wide search with 'fa' and .fa (note the quotes and dot).

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 docs/devel/build-system.rst         | 5 -----
 stubs/blk-exp-close-all.c           | 2 +-
 .gitlab-ci.d/buildtest-template.yml | 2 --
 .gitlab-ci.d/buildtest.yml          | 2 --
 gdbstub/meson.build                 | 2 --
 tcg/meson.build                     | 2 --
 tests/Makefile.include              | 2 +-
 tests/qtest/libqos/meson.build      | 1 -
 8 files changed, 2 insertions(+), 16 deletions(-)

Comments

Bernhard Beschow May 23, 2024, 8:44 a.m. UTC | #1
Am 22. Mai 2024 10:43:04 UTC schrieb Akihiko Odaki <akihiko.odaki@daynix.com>:
>The non-standard .fa library prefix breaks the link source

s/prefix/suffix/ in the commit message and subject.

Best regards,
Bernhard

>de-duplication done by Meson so drop it.
>
>The lack of link source de-duplication causes AddressSanitizer to
>complain ODR violations, and makes GNU ld abort when combined with
>clang's LTO.
>
>Previously, the non-standard prefix was necessary for fork-fuzzing.
>Meson wraps all standard-prefixed libraries with --start-group and
>--end-group. This made a fork-fuzz.ld linker script wrapped as well and
>broke builds. Commit d2e6f9272d33 ("fuzz: remove fork-fuzzing
>scaffolding") dropped fork-fuzzing so we can now restore the standard
>prefix.
>
>The occurances of the prefix was detected and removed by performing
>a tree-wide search with 'fa' and .fa (note the quotes and dot).
>
>Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>---
> docs/devel/build-system.rst         | 5 -----
> stubs/blk-exp-close-all.c           | 2 +-
> .gitlab-ci.d/buildtest-template.yml | 2 --
> .gitlab-ci.d/buildtest.yml          | 2 --
> gdbstub/meson.build                 | 2 --
> tcg/meson.build                     | 2 --
> tests/Makefile.include              | 2 +-
> tests/qtest/libqos/meson.build      | 1 -
> 8 files changed, 2 insertions(+), 16 deletions(-)
>
>diff --git a/docs/devel/build-system.rst b/docs/devel/build-system.rst
>index 09caf2f8e199..5baf027b7614 100644
>--- a/docs/devel/build-system.rst
>+++ b/docs/devel/build-system.rst
>@@ -236,15 +236,10 @@ Subsystem sourcesets:
>   are then turned into static libraries as follows::
> 
>     libchardev = static_library('chardev', chardev_ss.sources(),
>-                                name_suffix: 'fa',
>                                 build_by_default: false)
> 
>     chardev = declare_dependency(link_whole: libchardev)
> 
>-  As of Meson 0.55.1, the special ``.fa`` suffix should be used for everything
>-  that is used with ``link_whole``, to ensure that the link flags are placed
>-  correctly in the command line.
>-
> Target-independent emulator sourcesets:
>   Various general purpose helper code is compiled only once and
>   the .o files are linked into all output binaries that need it.
>diff --git a/stubs/blk-exp-close-all.c b/stubs/blk-exp-close-all.c
>index 1c7131676392..2f68e06d7d05 100644
>--- a/stubs/blk-exp-close-all.c
>+++ b/stubs/blk-exp-close-all.c
>@@ -1,7 +1,7 @@
> #include "qemu/osdep.h"
> #include "block/export.h"
> 
>-/* Only used in programs that support block exports (libblockdev.fa) */
>+/* Only used in programs that support block exports (libblockdev.a) */
> void blk_exp_close_all(void)
> {
> }
>diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml
>index 22045add8064..69e468a576ba 100644
>--- a/.gitlab-ci.d/buildtest-template.yml
>+++ b/.gitlab-ci.d/buildtest-template.yml
>@@ -45,10 +45,8 @@
>     exclude:
>       - build/**/*.p
>       - build/**/*.a.p
>-      - build/**/*.fa.p
>       - build/**/*.c.o
>       - build/**/*.c.o.d
>-      - build/**/*.fa
> 
> .common_test_job_template:
>   extends: .base_job_template
>diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
>index cfdff175c389..c156e6f1d90e 100644
>--- a/.gitlab-ci.d/buildtest.yml
>+++ b/.gitlab-ci.d/buildtest.yml
>@@ -178,10 +178,8 @@ build-previous-qemu:
>     exclude:
>       - build-previous/**/*.p
>       - build-previous/**/*.a.p
>-      - build-previous/**/*.fa.p
>       - build-previous/**/*.c.o
>       - build-previous/**/*.c.o.d
>-      - build-previous/**/*.fa
>   needs:
>     job: amd64-opensuse-leap-container
>   variables:
>diff --git a/gdbstub/meson.build b/gdbstub/meson.build
>index da5721d8452b..c91e398ae726 100644
>--- a/gdbstub/meson.build
>+++ b/gdbstub/meson.build
>@@ -19,13 +19,11 @@ gdb_system_ss = gdb_system_ss.apply({})
> 
> libgdb_user = static_library('gdb_user',
>                              gdb_user_ss.sources() + genh,
>-                             name_suffix: 'fa',
>                              c_args: '-DCONFIG_USER_ONLY',
>                              build_by_default: false)
> 
> libgdb_system = static_library('gdb_system',
>                                 gdb_system_ss.sources() + genh,
>-                                name_suffix: 'fa',
>                                 build_by_default: false)
> 
> gdb_user = declare_dependency(link_whole: libgdb_user)
>diff --git a/tcg/meson.build b/tcg/meson.build
>index 8251589fd4e9..f941413d5801 100644
>--- a/tcg/meson.build
>+++ b/tcg/meson.build
>@@ -31,7 +31,6 @@ tcg_ss = tcg_ss.apply({})
> 
> libtcg_user = static_library('tcg_user',
>                              tcg_ss.sources() + genh,
>-                             name_suffix: 'fa',
>                              c_args: '-DCONFIG_USER_ONLY',
>                              build_by_default: false)
> 
>@@ -41,7 +40,6 @@ user_ss.add(tcg_user)
> 
> libtcg_system = static_library('tcg_system',
>                                 tcg_ss.sources() + genh,
>-                                name_suffix: 'fa',
>                                 c_args: '-DCONFIG_SOFTMMU',
>                                 build_by_default: false)
> 
>diff --git a/tests/Makefile.include b/tests/Makefile.include
>index c9d1674bd070..d39d5dd6a43e 100644
>--- a/tests/Makefile.include
>+++ b/tests/Makefile.include
>@@ -87,7 +87,7 @@ distclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES)
> .PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning
> 
> # Build up our target list from the filtered list of ninja targets
>-TARGETS=$(patsubst libqemu-%.fa, %, $(filter libqemu-%.fa, $(ninja-targets)))
>+TARGETS=$(patsubst libqemu-%.a, %, $(filter libqemu-%.a, $(ninja-targets)))
> 
> TESTS_VENV_TOKEN=$(BUILD_DIR)/pyvenv/tests.group
> TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
>diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
>index 3aed6efcb8d1..45b81c83ade3 100644
>--- a/tests/qtest/libqos/meson.build
>+++ b/tests/qtest/libqos/meson.build
>@@ -68,7 +68,6 @@ if have_virtfs
> endif
> 
> libqos = static_library('qos', libqos_srcs + genh,
>-                        name_suffix: 'fa',
>                         build_by_default: false)
> 
> qos = declare_dependency(link_whole: libqos)
>
diff mbox series

Patch

diff --git a/docs/devel/build-system.rst b/docs/devel/build-system.rst
index 09caf2f8e199..5baf027b7614 100644
--- a/docs/devel/build-system.rst
+++ b/docs/devel/build-system.rst
@@ -236,15 +236,10 @@  Subsystem sourcesets:
   are then turned into static libraries as follows::
 
     libchardev = static_library('chardev', chardev_ss.sources(),
-                                name_suffix: 'fa',
                                 build_by_default: false)
 
     chardev = declare_dependency(link_whole: libchardev)
 
-  As of Meson 0.55.1, the special ``.fa`` suffix should be used for everything
-  that is used with ``link_whole``, to ensure that the link flags are placed
-  correctly in the command line.
-
 Target-independent emulator sourcesets:
   Various general purpose helper code is compiled only once and
   the .o files are linked into all output binaries that need it.
diff --git a/stubs/blk-exp-close-all.c b/stubs/blk-exp-close-all.c
index 1c7131676392..2f68e06d7d05 100644
--- a/stubs/blk-exp-close-all.c
+++ b/stubs/blk-exp-close-all.c
@@ -1,7 +1,7 @@ 
 #include "qemu/osdep.h"
 #include "block/export.h"
 
-/* Only used in programs that support block exports (libblockdev.fa) */
+/* Only used in programs that support block exports (libblockdev.a) */
 void blk_exp_close_all(void)
 {
 }
diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml
index 22045add8064..69e468a576ba 100644
--- a/.gitlab-ci.d/buildtest-template.yml
+++ b/.gitlab-ci.d/buildtest-template.yml
@@ -45,10 +45,8 @@ 
     exclude:
       - build/**/*.p
       - build/**/*.a.p
-      - build/**/*.fa.p
       - build/**/*.c.o
       - build/**/*.c.o.d
-      - build/**/*.fa
 
 .common_test_job_template:
   extends: .base_job_template
diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index cfdff175c389..c156e6f1d90e 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -178,10 +178,8 @@  build-previous-qemu:
     exclude:
       - build-previous/**/*.p
       - build-previous/**/*.a.p
-      - build-previous/**/*.fa.p
       - build-previous/**/*.c.o
       - build-previous/**/*.c.o.d
-      - build-previous/**/*.fa
   needs:
     job: amd64-opensuse-leap-container
   variables:
diff --git a/gdbstub/meson.build b/gdbstub/meson.build
index da5721d8452b..c91e398ae726 100644
--- a/gdbstub/meson.build
+++ b/gdbstub/meson.build
@@ -19,13 +19,11 @@  gdb_system_ss = gdb_system_ss.apply({})
 
 libgdb_user = static_library('gdb_user',
                              gdb_user_ss.sources() + genh,
-                             name_suffix: 'fa',
                              c_args: '-DCONFIG_USER_ONLY',
                              build_by_default: false)
 
 libgdb_system = static_library('gdb_system',
                                 gdb_system_ss.sources() + genh,
-                                name_suffix: 'fa',
                                 build_by_default: false)
 
 gdb_user = declare_dependency(link_whole: libgdb_user)
diff --git a/tcg/meson.build b/tcg/meson.build
index 8251589fd4e9..f941413d5801 100644
--- a/tcg/meson.build
+++ b/tcg/meson.build
@@ -31,7 +31,6 @@  tcg_ss = tcg_ss.apply({})
 
 libtcg_user = static_library('tcg_user',
                              tcg_ss.sources() + genh,
-                             name_suffix: 'fa',
                              c_args: '-DCONFIG_USER_ONLY',
                              build_by_default: false)
 
@@ -41,7 +40,6 @@  user_ss.add(tcg_user)
 
 libtcg_system = static_library('tcg_system',
                                 tcg_ss.sources() + genh,
-                                name_suffix: 'fa',
                                 c_args: '-DCONFIG_SOFTMMU',
                                 build_by_default: false)
 
diff --git a/tests/Makefile.include b/tests/Makefile.include
index c9d1674bd070..d39d5dd6a43e 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -87,7 +87,7 @@  distclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES)
 .PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning
 
 # Build up our target list from the filtered list of ninja targets
-TARGETS=$(patsubst libqemu-%.fa, %, $(filter libqemu-%.fa, $(ninja-targets)))
+TARGETS=$(patsubst libqemu-%.a, %, $(filter libqemu-%.a, $(ninja-targets)))
 
 TESTS_VENV_TOKEN=$(BUILD_DIR)/pyvenv/tests.group
 TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
index 3aed6efcb8d1..45b81c83ade3 100644
--- a/tests/qtest/libqos/meson.build
+++ b/tests/qtest/libqos/meson.build
@@ -68,7 +68,6 @@  if have_virtfs
 endif
 
 libqos = static_library('qos', libqos_srcs + genh,
-                        name_suffix: 'fa',
                         build_by_default: false)
 
 qos = declare_dependency(link_whole: libqos)