Summary: | Tests fail to build when build with LTO on gcc 5.3.0 | ||
---|---|---|---|
Product: | Wayland | Reporter: | Link Mauve <bugs> |
Component: | weston | Assignee: | Wayland bug list <wayland-bugs> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | CC: | mike, octoploid |
Version: | unspecified | ||
Hardware: | x86-64 (AMD64) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Link Mauve
2016-03-17 19:43:27 UTC
I'd guess -flto is throwing away the special section where we collect the test headers. The section is used to avoid having to create a master list of all tests in addition to writing the tests. Is there a way to mark that section to not be deleted by LTO? We rely on the compiler to automatically generate __start_test_section and __stop_test_section when putting things into the section. Gains size? You mean it's bigger with LTO? Sure: diff --git a/tests/test-runner.h b/tests/test-runner.h index 64f8d4c6aa4f..600d77c93833 100644 --- a/tests/test-runner.h +++ b/tests/test-runner.h @@ -41,7 +41,7 @@ struct test { static void name(void); \ \ const struct test test##name \ - __attribute__ ((section ("test_section"))) = { \ + __attribute__ ((used, section ("test_section"))) = { \ #name, name, 0 \ }; \ \ @@ -51,7 +51,7 @@ struct test { static void name(void); \ \ const struct test test##name \ - __attribute__ ((section ("test_section"))) = { \ + __attribute__ ((used, section ("test_section"))) = { \ #name, name, 1 \ }; \ \ Same error here. I've created a bug on the Gentoo tracker, with a patch for Weston 3.0.0: * bug: https://bugs.gentoo.org/634572 * patch: https://634572.bugs.gentoo.org/attachment.cgi?id=499022 Please consider applying this if it's suitable. :) Oh and btw this is with GCC 7.2.0. Hi, thanks for your patch, I also sent one to the mailing list back in April, see https://patchwork.freedesktop.org/series/23087/ Pushed to the list now; __attribute__((used)) seems to DTRT on both GCC and clang. Thanks! |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.