From 43ae3503904d42a171305b2708f9fd1d37a352ea Mon Sep 17 00:00:00 2001
From: wanjochan <wanjochan@gmail.com>
Date: Thu, 17 Sep 2020 00:47:32 +0800
Subject: [PATCH] tcc_add_support(): skip when filename is empty

---
 tccelf.c | 1 +
 tccpe.c  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/tccelf.c b/tccelf.c
index 452f4ebd..45dc474a 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -1320,6 +1320,7 @@ static void add_init_array_defines(TCCState *s1, const char *section_name)
 #ifndef TCC_TARGET_PE
 static int tcc_add_support(TCCState *s1, const char *filename)
 {
+    if(!filename || strlen(filename)==0) return 0;
     char buf[1024];
     snprintf(buf, sizeof(buf), "%s/%s", s1->tcc_lib_path, filename);
     return tcc_add_file(s1, buf);
diff --git a/tccpe.c b/tccpe.c
index c2aad8a1..0998a218 100644
--- a/tccpe.c
+++ b/tccpe.c
@@ -1855,6 +1855,7 @@ ST_FUNC void pe_add_unwind_data(unsigned start, unsigned end, unsigned stack)
 
 static void tcc_add_support(TCCState *s1, const char *filename)
 {
+    if(!filename || strlen(filename)==0) return 0;
     if (tcc_add_dll(s1, filename, 0) < 0)
         tcc_error_noabort("%s not found", filename);
 }