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.
Unified · Split
| @@ -314,8 +314,11 @@ int main(int argc, char **argv) · 313 unmodified lines | ||
| 314 | 314 | const char *filename = s->files[i] + 1; |
| 315 | 315 | if (filename[0] == '-' && filename[1] == 'l') { |
| 316 | 316 | if (tcc_add_library(s, filename + 2) < 0) { |
| 317 | − tcc_error_noabort("cannot find library 'lib%s'", filename+2); | |
| 318 | − ret = 1; | |
| 317 | + /* don't fail on -lm as it's harmless to skip math lib */ | |
| 318 | + if (strcmp(filename + 2, "m")) { | |
| 319 | + tcc_error_noabort("cannot find library 'lib%s'", filename + 2); | |
| 320 | + ret = 1; | |
| 321 | + } | |
| 319 | 322 | } |
| 320 | 323 | } else { |
| 321 | 324 | if (1 == s->verbose) |