Proposal Details
Currently I am using TamaGo to compile go to run on bare metal. The memory layout for the bare metal device assumes that RAM starts from a specific address. Looking at the linker, it seems to put data like BSS after .text.
Possible change
Looking in the linker, I think an if statement could be added after this line to check if -D was supplied:
// If -D flag is specified, use it
if *FlagDataAddr != -1 {
va = uint64(*FlagDataAddr)
}
and then a change in layout since it seems to assume that virtual addresses are contiguous
Note
It's not possible to use an external linker in this case. Opening this up assuming that this flag is useful in general
Comment From: seankhliao
Sounds like this should be a change made in tamago. We can consider it as part of #73608 if necessary.
Comment From: kevaundray
Sounds like this should be a change made in tamago. We can consider it as part of #73608 if necessary.
Not sure I understand -- I think this can be also considered in isolation of that proposal
Comment From: cherrymui
I feel it is okay to add a -D flag. FWIW, the Plan 9 linker, which the Go linker is originally based on, has a -D flag.
On the other hand, it is unclear to me whether this is useful (usable) on the platforms we support. If it is not usable on regular platforms, it would be difficult to test.