------- Additional Comments From nickc at redhat dot com 2010-09-27 15:41 ------- There is a discrepancy between the behaviour of LD and GOLD with regard to unspecified VMA and LMA values for sections mentioned in linker scripts that use memory regions. LD will place any section which does not have an explicit VMA address or an explicit output region into the first region in the MEMORY list that has compatible attributes. (In the testcase being used in the LD and GOLD testsuites this means that sec0 is placed into region2). This is contrary to the documentation which says:
Output Section Address The "address" is an expression for the VMA (the virtual memory address) of the output section. If you do not provide "address", the linker will set it based on "region" if present, or otherwise based on the current value of the location counter. If the section has an VMA address but does not have an LMA address then LD will again base the LMA on the first compatible memory region, whereas GOLD will just set the LMA to be the same as the VMA. The manual states that: If neither AT nor AT> is specified for an allocatable section, the linker will set the LMA such that the difference between VMA and LMA for the section is the same as the preceding output section in the same region. If there is no preceding output section or the section is not allocatable, the linker will set the LMA equal to the VMA. It does not specify what happens if the section does not have a memory region specified for it. In the testcase sec3 is given an LMA of 0x5000 by GOLD (the same as its VMA) but it is given an LMA of 0x412c by LD. (0x412c comes from subtracting 0xed4 from 0x5000, so that VMA - LMA of sec3 == VMA - LMA of sec1. sec1 is in region2 which is the first viable memory region). I am now working on a patch to: a) update the linker documentation. (On the assumption that LD's behaviour is correct). b) update GOLD to behave in the same way as LD. -- http://sourceware.org/bugzilla/show_bug.cgi?id=11997 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils