Skip math library if not found when -lm option is used

This only silences "cannot find library" error and allows Makefiles targeting gcc to not complain about missing libraries

If there is custom libm then standard handling applies.
This commit is contained in:
Vlad Vissoultchev 2016-04-06 19:25:30 +03:00
parent e946eb2a41
commit 174d06a3ff

7
tcc.c
View File

@ -314,8 +314,11 @@ int main(int argc, char **argv)
const char *filename = s->files[i] + 1;
if (filename[0] == '-' && filename[1] == 'l') {
if (tcc_add_library(s, filename + 2) < 0) {
tcc_error_noabort("cannot find library 'lib%s'", filename+2);
ret = 1;
/* don't fail on -lm as it's harmless to skip math lib */
if (strcmp(filename + 2, "m")) {
tcc_error_noabort("cannot find library 'lib%s'", filename + 2);
ret = 1;
}
}
} else {
if (1 == s->verbose)