https://sourceware.org/bugzilla/show_bug.cgi?id=32463
--- Comment #3 from Nick Clifton <nickc at redhat dot com> --- (In reply to Stas Sergeev from comment #2) > I probably forgot to mention the > most important thing. If you change: > > TTT = .; > _LGROUP = TTT; > > into: > _LGROUP = .; > > then suddenly bfg linker gives: > 00000000 R _LGROUP > ... same as lld. > > So the bug here is that just by using > the intermediate var TTT we get the > entirely different result. > Or is this not a bug? Ah yes, this is interesting. It is debatable as whether it is a bug or not. The BFD linker documentation says: 3.5.1 Simple Assignments ------------------------ [...] The section of the symbol will be set from the section of the expression; for more information, see Expression Section. And then: 3.10.8 The Section of an Expression ----------------------------------- Addresses and symbols may be section relative, or absolute. [...] Expressions appearing outside an output section definition treat all numbers as absolute addresses. Expressions appearing inside an output section definition treat absolute symbols as numbers. But the location counter is special: 3.10.5 The Location Counter --------------------------- The special linker variable "dot" '.' always contains the current output location counter. Since the '.' always refers to a location in an output section, it may only appear in an expression within a 'SECTIONS' command. What I could not find in the documentation however is anything that explicitly states the "expression section" for an expression involving the location counter when referenced outside of an output section definition. I think that this is probably a case where it would be very unwise to change the behaviour of the linker - since there are bound to be scripts that depend upon the current behaviour. Instead we should update the documentation to make this issue clear and to offer advice on how to cope with it. -- You are receiving this mail because: You are on the CC list for the bug.