Skip to content
Snippets Groups Projects
Commit 7b52f181 authored by J. Dekker's avatar J. Dekker
Browse files

meson: disable LTO in HAVE_AS_FUNC check


When LTO is enabled using -flto, simply compiling does not
produce an error. Either LTO must be turned off or a linking check must
be performed. LTO does not seem to affect non-assembly checks.

This behaviour can be seen in the following test:

    $ cat t.c
    int main(void)
    {
        __asm__ (".foobar this_directive_doesnt_exist");
        return 0;
    }
    $ cc t.c -o t.o -flto -c
    $ echo $?
    0
    $ cc t.c -o t.o -flto
    ld: <inline asm>:1:2: unknown directive
        .foobar this_directive_doesnt_exist
        ^
     for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    $ echo $?
    1

Signed-off-by: default avatarJ. Dekker <jdek@itanimul.li>
parent 1ed24f06
Branches master
No related tags found
No related merge requests found
Pipeline #325166 failed with stages
in 7 minutes and 50 seconds
......@@ -346,7 +346,7 @@ if (is_asm_enabled and
".endfunc"
);
'''
have_as_func = cc.compiles(as_func_code)
have_as_func = cc.compiles(as_func_code, args: '-fno-lto')
cdata.set10('HAVE_AS_FUNC', have_as_func)
# fedora package build infrastructure uses a gcc specs file to enable
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment