Steve McIntyre wrote:
Upstream glibc have generally not been welcoming of these patches, and I understand this; the approach taken (reading ARM-specific build attributes) is far from clean and doesn't fit well in the design of ld.so in particular.
Nevertheless, the tags in the .ARM.attributes section are the standard, published way to identify FP ABI as well as a number of other properties that might be relevant to a linker.
Not according to the glibc folks, no. They're prepared to look at the attributes at other times, but not in ld.so. And it's their code.
[snip]
I really think the only sane thing to do is fix glibc so it can fetch the attributes from their standard locations.
I've already proposed (and written code for) that, and they refused to accept that method.
Unfortunately I haven't really followed this discussion, so I don't know the reasons why they didn't like your code.
My suspicion would be that it relates to the fundamental distiction in ELF between link-time and load-time fields: the ELF format holds both contents that are supposed to be manipulated on-file by tools like a linker, and contents that are supposed to be accessed in-memory by tools like a dynamic loader.
glibc / ld.so --quite reasonably in my opinion-- would use only those parts of ELF that are readily available at run time. This includes everything available off a program header (and thus part of the memory-mapped part of the file), but *not* things available only in a section.
Unfortunately, the .ARM.attribute section is of the second class. It is avilable to link-time tools that operate on an ELF file, but not readily available to run-time tools like ld.so that operate on the memory-mapped image. Having ld.so bypass this very fundamental separation between link-time and run-time by itself opening the ELF file and reading pieces that are not memory-mapped really seems not a good idea.
However, there are ways to solve this type of problem, which usually involve changing the linker to make a piece of information that used to be available only at link-time also available at run-time. Typically this means moving the section into the memory-mapped part of the file, and also covering it by a new program header so that it can be found by run-time tools.
This is done e.g. for the .note.ABI-tag section (which serves a similar purpose as .ARM.attributes). While this is primarily a *section* used at link time, it is also made available as part of the NOTE program header in the memory-mapped part at run-time (and this is where ld.so actually uses it).
My suggestion to address this issue would therefore be to have the linker create a new program header ARM_ATTRIBUTES to cover the .ARM.attributes section (and move it into the memory-mapped area also covered by a LOAD program header). ld.so would then be able to use its contents just as it today uses .note.ABI-tag.
This solution obviously still requires all programs to be recompiled before they present the new program header. However, it avoids the two drawbacks of your method Mans pointed out: - there is no duplication of data (there is a bit of extra meta data in the form of the new program header, but the actual data covered by it is not duplicated) - there are no future extensibility issues due to the use of a single byte
Thoughts?
Mit freundlichen Gruessen / Best Regards
Ulrich Weigand
-- Dr. Ulrich Weigand | Phone: +49-7031/16-3727 STSM, GNU compiler and toolchain for Linux on System z and Cell/B.E. IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz | Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht Stuttgart, HRB 243294