> Given that I want a relative offset, and I have explicitly coded a
> relative offset, I don't see how that is a hack. I see assembly
> for is telling the machine explicitly what to do and that does.
No, this is not a relative offset (it would be appropriate if the
program tries to relocate itself), but a genuine address in a program
which always runs from address 0 (relative to some segment, but it
doesn't matter).
> One of the other reasons I want to do it this way is in case is to
> make copying code easier. If you use idioms that work equally well
> everywhere and for every case it is easier to switch between projects
> using the same tool. And the assume 0 hack isn't useful when
> switching from real to protected mode while using the code segment
> you got from the reset vector. Although it is kind of fun running
> real mode code with a code segment base of 0xffff0000.
Agreed, but in this case it's perfectly clear that the code will run
from address 0, so it should be written as such.
For such purposes, it would be wonderful if somebody could teach gas
how to assemble absolute code and make real location of code and base
for calculation of symbols independent. It probably could be done with
sections and a cleverly written ldscript (modulo ld bugs), but it's
nowhere near elegant.
Have a nice fortnight
-- Martin `MJ' Mares <mj@ucw.cz> http://atrey.karlin.mff.cuni.cz/~mj/ Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth A student who changes the course of history is probably taking an exam. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/