How to get rid of automatically added library provided by GCC?

0

I'm compiling main.c file by gcc with enabled sanitizer option.

As a result, linker command contains "-lubsan" option in its arguments list.

Need to say, that I haven't provided "-lubsan" option to gcc explicitly.

Moreover, I'm against of using it.

So, the question is: "How to get rid of such automatically added option?

Is it possible to do this without separating compilation and link commands?".

Content of the main.c file:

int main()
{
    volatile int a=0x7fffffff;
    a = a<<1;
    return a;
}

Content of build_gcc_host.sh file:

#!/bin/bash
gcc \
-fsanitize=shift \
main.c \
-o \
main \
-### \
2>&1 \
| \
grep ubsan

P.S. The "-lubsan" will not be added if to use "-nostdlib" option, but I do need "stdlib".

I simply don't need automatically added "-lubsan".

gcc
linker
ubsan
asked on Stack Overflow Nov 12, 2019 by lol lol

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0