[ELF] Accept first SHT_ARM_ATTRIBUTES section
authorPeter Smith <peter.smith@linaro.org>
Wed, 14 Dec 2016 10:36:12 +0000 (10:36 +0000)
committerPeter Smith <peter.smith@linaro.org>
Wed, 14 Dec 2016 10:36:12 +0000 (10:36 +0000)
commit532bc984f58ed66e7fe7b9c6493d6ad808a89772
treea26a6fe97cc7d3432dc3263bdb20c6681b2710c9
parent3abd1d3e12402e04c55957e2cbc4e9a9a8c0809c
[ELF] Accept first SHT_ARM_ATTRIBUTES section

The eglibc library, as used by Ubuntu 14.04 requires the presence of an
SHT_ARM_ATTRIBUTES section in for the purposes of checking hard/soft float
compatibility when dlopen() is used. Unfortunately when the section is not
present dlopen() fails with a generic could not find file message.

This change makes lld keep the first .ARM.attributes section that it
encounters and propagates it to the output. This is not a complete
SHT_ARM_ATTRIBUTES implementation, that would involve reading the contents
of the section and joining each individual attribute. It should suffice
for a homogenous build all libraries and executables on the same system
with a compatible set of command line options.

Differential revision: https://reviews.llvm.org/D27718

llvm-svn: 289642
lld/ELF/InputFiles.cpp
lld/ELF/SyntheticSections.h
lld/test/ELF/Inputs/arm-attributes1.s [moved from lld/test/ELF/arm-attributes-remove.s with 59% similarity]
lld/test/ELF/arm-attributes.s [new file with mode: 0644]