> 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.
Agreed. This is what is really wanted for gas to know that %ds
points to the start of .text or some other section. This would allow
gas to resolve section relative addresses without asking for
assistance from the linker. Or if it did ask for assistance the
linker could give the desired answer...
> It probably could be done with
> sections and a cleverly written ldscript (modulo ld bugs), but it's
> nowhere near elegant.
I have two ideas to clear up the picture a little, and still retain
the full usefulness of the .o files. Since the code is relocatable
it is simply nonsense to directly use any of the addresses it
exports. All that is interesting are the load addresses, and relative
offsets.
replace ``foo - start'' with: ``D(foo)'' where the macro does the
work.
Or use a linker script of the form:
.bootsect 0 : AT(0x90000) {
*(.bootsect)
}
.setup 0 : AT(0x90200) {
*(.setup)
}
The ld bugs I have seen have mostly been related to choosing file
offsets to store the data, and ELF program headers, so I this
shouldn't tickle any of ld's bugs.
Which form do you prefer?
Eric
-
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/