Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22122

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

$
0
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".


Viewing all articles
Browse latest Browse all 22122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>