From 2de11b5574792a4eb2a9e0828cfbf84a1aa74c39 Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Sun, 3 May 2015 23:22:29 +0200 Subject: [PATCH] Accept extern label redeclaration as global --- labels.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/labels.c b/labels.c index e14fe474..9a2c663c 100644 --- a/labels.c +++ b/labels.c @@ -293,12 +293,22 @@ void define_label(char *label, int32_t segment, int64_t offset, char *special, if (!lptr) return; if (lptr->defn.is_global & DEFINED_BIT) { - nasm_error(ERR_NONFATAL, "symbol `%s' redefined", label); - return; + if (lptr->defn.is_global & EXTERN_BIT) + { + /* if defined as extern, redefine symbol as global. */ + /* say hello to header files like in C ! */ + lptr->defn.is_global |= GLOBAL_BIT; + } + else + { + nasm_error(ERR_NONFATAL, "symbol `%s' redefined", label); + return; + } + } else { + lptr->defn.is_global |= DEFINED_BIT; + if (isextrn) + lptr->defn.is_global |= EXTERN_BIT; } - lptr->defn.is_global |= DEFINED_BIT; - if (isextrn) - lptr->defn.is_global |= EXTERN_BIT; if (!islocalchar(label[0]) && is_norm) { /* not local, but not special either */ -- 2.11.4.GIT