[Nasm-bugs] [Bug 3392728] New: Symbol can be declared global even if not present

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Sun Dec 20 04:26:41 PST 2020


            Bug ID: 3392728
           Summary: Symbol can be declared global even if not present
           Product: NASM
           Version: 2.14.xx
          Hardware: All
                OS: All
            Status: OPEN
          Severity: normal
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: james.harris.1 at gmail.com
                CC: chang.seok.bae at intel.com, gorcunov at gmail.com,
                    hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: From OS distribution

Nasm will allow a symbol to be declared global (i.e. to be exported) even if it
is not in the source file. 

Sample source f2.nasm:

  extern symb
  global symb
    mov eax, [symb]

Command nasm -f elf f2.nasm  doesn't report any error but AISI could/should
report both of 

1. Symbol declared as global is not present.
2. One symbol cannot be both extern and global.

This is not just an inconvenience but appears to have led to some machine code
calling a different routine from that specified in the source. See the
following link for details. 


I can see that a programmer might want extern before global if a file of
externs is %included into multiple sources so a warning may be ehough for that
case but AFAICS declaring as global a missing symbol should be reported as an

You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.

More information about the Nasm-bugs mailing list