From 174d06a3ff549702d1c7b9df6ce7a096801ba3ae Mon Sep 17 00:00:00 2001 From: Vlad Vissoultchev Date: Wed, 6 Apr 2016 19:25:30 +0300 Subject: [PATCH] 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. --- tcc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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)