~emersion/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH basu] meson: fix linking on LLD 13/LD 2.37 and older CCs

Details
Message ID
<20220125181311.1629174-1-arsen@aarsen.me>
DKIM signature
pass
Download raw message
Patch: +16 -0
For compilers that do not support __attribute((retain)),
-z no-start-stop-gc is a requirement.
---
Hello!

While 5fa970e868f25ebc79ccca9b1d9df4c030d97661 fixes linking on LLD 13 with
recent versions of GCC and clang, it doesn't resolve the issue on GCC 11 + LLD
13. This patch makes it so that meson detects the lack of support for
__attribute__((retain)) and instead falls back to the suboptimal
``-z nostart-stop-gc'' solution.

Compilers without ``-z start-stop-gc'' shouldn't encounter this issue at all,
so no scoping based on version is necessary

 meson.build | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/meson.build b/meson.build
index 1f29690..ffc79d2 100644
--- a/meson.build
+++ b/meson.build
@@ -101,6 +101,22 @@ if get_option('buildtype') != 'debug'
        possible_link_flags += '-Wl,--gc-sections'
endif

if cc.get_id() in ['gcc', 'clang']
        # XXX(arsen): remember to update with a future meson release
        has_retain_attr = cc.compiles(
                '__attribute__((retain)) const int x;',
                args : ['-Werror=attributes'],
                name : 'compiler supports __attribute__((retain))'
        )

        if not has_retain_attr and cc.has_link_argument('-Wl,-z,start-stop-gc')
                possible_link_flags += [
                        '-Wl,-z,nostart-stop-gc'
                ]
        endif
endif


add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')

-- 
2.34.1

[basu/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CHEYK05V7867.32CQ0ZP1IY56I@cirno2>
In-Reply-To
<20220125181311.1629174-1-arsen@aarsen.me> (view parent)
DKIM signature
missing
Download raw message
basu/patches: SUCCESS in 54s

[meson: fix linking on LLD 13/LD 2.37 and older CCs][0] from [Arsen Arsenović][1]

[0]: https://lists.sr.ht/~emersion/public-inbox/patches/28722
[1]: arsen@aarsen.me

✓ #680838 SUCCESS basu/patches/alpine.yml  https://builds.sr.ht/~emersion/job/680838
✓ #680839 SUCCESS basu/patches/freebsd.yml https://builds.sr.ht/~emersion/job/680839

[PATCH basu v2] meson: fix linking on LLD 13/LD 2.37 and older CCs

Details
Message ID
<20220125192953.1781959-1-arsen@aarsen.me>
In-Reply-To
<20220125181311.1629174-1-arsen@aarsen.me> (view parent)
DKIM signature
pass
Download raw message
Patch: +16 -0
For compilers that do not support __attribute((retain)),
-z no-start-stop-gc is a requirement.
---
Hello,

I apologize for coming up again so soon, but I noticed, while implementing this
for upstreaming in meson, that int x in the test case being const could trip up
a different warning and fool the detection.

This reiteration addresses that.

 meson.build | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/meson.build b/meson.build
index 1f29690..74e9934 100644
--- a/meson.build
+++ b/meson.build
@@ -101,6 +101,22 @@ if get_option('buildtype') != 'debug'
        possible_link_flags += '-Wl,--gc-sections'
endif

if cc.get_id() in ['gcc', 'clang']
# XXX(arsen): remember to update with a future meson release
        has_retain_attr = cc.compiles(
                '__attribute__((retain)) int x;',
                args : ['-Werror=attributes'],
                name : 'compiler supports __attribute__((retain))'
        )

        if not has_retain_attr and cc.has_link_argument('-Wl,-z,start-stop-gc')
                possible_link_flags += [
                        '-Wl,-z,nostart-stop-gc'
                ]
        endif
endif


add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')

-- 
2.34.1
Reply to thread Export thread (mbox)