[Nasm-bugs] [Bug 3392729] New: Nasm allows symbol to be declared global (exported) even if not present

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


            Bug ID: 3392729
           Summary: Nasm allows symbol to be declared global (exported)
                    even if not present
           Product: NASM
           Version: 2.14.xx
          Hardware: PC
                OS: Linux
            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 2.14 allows 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. A symbol cannot be both extern and global.

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


It's possible a programmer might want extern before global if a file of externs
is %included into multiple sources so a warning may be enough for that case but
AFAICS declaring as global a missing symbol should be reported as an error.

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