The linker will normally set the LMA equal to the VMA.
You can change that by using the AT keyword.
The expression lma that follows the AT keyword specifies
the load address of the section.
Patch implements this keyword.
Differential D19272
[ELF] - linkerscript AT keyword (in output section description) implemented. grimar on Apr 19 2016, 9:54 AM. Authored by
Details The linker will normally set the LMA equal to the VMA. Patch implements this keyword.
Diff Detail
Event Timeline
Comment Actions
Comment Actions I wonder if you are implementing this feature for some specific product. For example, are you trying to link some kernel or something? Or are you doing this for the sake of completeness? It seems to me that AT command is a tricky option that you want to use only when you are dealing with embedded systems or something.
Comment Actions I am using freebsd script as reference (https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?view=markup), assuming that it contains some Comment Actions
Comment Actions Note that AT was introduced to the FreeBSD kernel linker script only recently, https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?r1=284869&r2=284870& For testing I'll revert that commit but we will need it to be supported.
Comment Actions FYI the linker script parser now handles all of the FreeBSD kernel linker script except for AT. Now the only kernel linker script workaround in my test FreeBSD tree is: diff --git a/sys/conf/ldscript.amd64 b/sys/conf/ldscript.amd64 index d445857..3efca9a 100644 --- a/sys/conf/ldscript.amd64 +++ b/sys/conf/ldscript.amd64 @@ -8,12 +8,7 @@ SECTIONS /* Read-only sections, merged into text segment: */ kernphys = CONSTANT (MAXPAGESIZE); . = kernbase + kernphys + SIZEOF_HEADERS; - /* - * Use the AT keyword in order to set the right LMA that contains - * the physical address where the section should be loaded. This is - * needed for the Xen loader which honours the LMA. - */ - .interp : AT (kernphys + SIZEOF_HEADERS) { *(.interp) } + .interp : { *(.interp) } .hash : { *(.hash) } .gnu.hash : { *(.gnu.hash) } .dynsym : { *(.dynsym) } Comment Actions Yes, I know. I am testing it with the same "change". I think 10.3 release sources head does not contain AT and I using them. I am not sure how to test properly that AT implementation is correct ? Since it is not important to have for FreeBSD. Comment Actions As far as I can tell the Xen loader in FreeBSD loader uses it. Eventually we might want to try (or ask somebody to try). Comment Actions But, to clarify, it's important :) (or at least there are some people using Xen which care about it =)) Comment Actions We'd like to use LLD for linking LK kernel and the AT keyword support is currently the only thing that's stopping us, so landing this change would really help us as well. Comment Actions IMHO that's the case not only for AT command but for linker scripts in general, vast majority of linker script use cases would be kernels and embedded systems. Comment Actions Did you try to link with this patch applied ? I am curios whether this patch is enough to support AT. Comment Actions This change needs a test.
Comment Actions
Comment Actions LGTM
|