diff --git a/tcc.c b/tcc.c index 95e1a15f..6d9bf527 100644 --- a/tcc.c +++ b/tcc.c @@ -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)