From 4e9842ef33789dae702302509d6c6b8d0acccb13 Mon Sep 17 00:00:00 2001 From: Greg King Date: Sun, 9 Aug 2015 06:27:05 -0400 Subject: [PATCH 1/1] Stopped extern declarations from changing previous static, but otherwise identical, declarations. --- src/cc65/symtab.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cc65/symtab.c b/src/cc65/symtab.c index 1f63e9430..0e4de4ea2 100644 --- a/src/cc65/symtab.c +++ b/src/cc65/symtab.c @@ -813,6 +813,11 @@ SymEntry* AddGlobalSym (const char* Name, const Type* T, unsigned Flags) } } + /* An extern declaration must not change the current linkage. */ + if (IsFunc || (Flags & (SC_EXTERN | SC_DEF)) == SC_EXTERN) { + Flags &= ~SC_EXTERN; + } + /* Add the new flags */ Entry->Flags |= Flags; -- 2.39.2