[Nasm-bugs] [Bug 3392571] inter-section call doesn't cause error or warning

noreply-nasm at gorcunov.org noreply-nasm at gorcunov.org
Sat Aug 10 07:05:04 PDT 2019


https://bugzilla.nasm.us/show_bug.cgi?id=3392571

--- Comment #10 from H. Peter Anvin <hpa at zytor.com> ---
First of all, even if jumps are handled, there are all kinds of other memory
references which could bite you, and there really isn't any way for NASM to
know what should be permitted; for example, is taking the address of a symbol?

And now for the painful details why this is a headache implementation-wise...
(read: there is just not enough of me...)


In the current code the backend doesn't know about jumps, and the front end
doesn't actually know about sections. The latter is of course insane, but it
obnoxiously requires doing stupidly major surgery on the expression evaluation
code (this is stuff that predates my taking over the project in 1999, so 20+
years old code.)

The problem is that NASM passes around four kinds of values in a single
integer, and sometimes it is even stuffed into a generic, nondedicated integer
variable:

 - Null section (NO_SEG)
 - Absolute segment reference (in the range 0-0xffff, although the code
   actually uses a wider bitmask "just because")
 - A section
 - A section segment reference (SEG operator or similar)

Fixing that would enable pushing a *ton* of code up from the backends into the
generic code, so that would be A Good Thing.

There is a new backend interface which allows the backend to know about what
instructions are coming down the pipe and not just how they are encoded; this
is actually required for some corner cases in both ELF and Mach-O, and really,
really needs to be plumbed into the various backends, but that is some pretty
heavy lifting, too. (Right now, *all* the backends except the debug backend
receives data through a converter which converts to the legacy backend
interface.)

It is pretty much a prerequisite for solving the section problem, too...

-- 
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