From f283c8f5c26bf16a9c1ae9e58e41da68b654a1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sun, 13 Aug 2017 17:28:46 +0300 Subject: [PATCH] preproc: Add found files to the list of dependencies even when cached MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the dependency listings as generated with -MD (if assembling runs in multiple passes). https://bugzilla.nasm.us/show_bug.cgi?id=3392420 gorcunov@: add missing zero byte Signed-off-by: Martin Storsjö Signed-off-by: Cyrill Gorcunov Signed-off-by: H. Peter Anvin --- asm/preproc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/asm/preproc.c b/asm/preproc.c index 0d0e1040..f06f400c 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -1574,6 +1574,14 @@ static FILE *inc_fopen(const char *file, hp = hash_find(&FileHash, file, &hi); if (hp) { path = *hp; + if (path || omode != INC_NEEDED) { + const char *name = path ? path : file; + size_t name_len = strlen(name); + sl = nasm_malloc(name_len + 1 + sizeof sl->next); + memcpy(sl->str, name, name_len+1); + sl->next = NULL; + nasm_add_to_strlist(dhead, sl); + } } else { /* Need to do the actual path search */ size_t file_len;