This patch provides implementation of R_ARM_TARGET1 relocation with configuration of its behaviour from a command line.
The R_ARM_TARGET1 relocation is processed in platform specific manner. Depending of the libc configuration it may be implemented as R_ARM_ABS32 or R_ARM_REL32. The decision which exact relocation should be used instead of R_ARM_TARGET1 is made immediately before the lld launch according to corresponding libc configuration. For example, linaro glibc expects R_ARM_ABS32 for R_ARM_TARGET1 relocation. It is flexible to configure lld with corresponding substitution for R_ARM_TARGET1 relocation from a command line (in the same way as ld utility works).
This patch provides two command line options for GnuLd driver: --arm-target1-rel and --arm-target1-abs (similar to ld option names with extra prefix 'arm-'). So user may choose which behaviour of R_ARM_TARGET1 is preferred for his implementation of libc (by default lld is using R_ARM_ABS32 relocation for R_ARM_TARGET1).
During the work of this patch there was an issue with implementation of command line options. They couldn't be implemented only in the driver file (GnuLdDriver.cpp) because they are target specific and should be ignored (and user should be warned about wrong using) for all targets except of armelf_linux_eabi. In this patch processing of target specific command line arguments has been divided on three parts:
- general processing of target specific options inside the driver (GnuLdDriver.cpp): it passes all arguments from grp_targetopts group to the ELFLinkingContext::applyTargetSpecificArgument method;
- printing warning about unknown target specific arguments in the implementation of ELFLinkingContext::applyTargetSpecificArgument;
- actual processing of incoming target specific arguments in the ARMLinkingContext::applyTargetSpecificArgument method (inside the lib\ReaderWriter\ELF\ARM component).
Thus, if the ARMLinkingContext::applyTargetSpecificArgument is called with known target specific argument (arm-target1-rel or arm-target1-abs), it processes it byself; in case of unknown argument, this method passes it to ELFLinkingContext::applyTargetSpecificArgument which finally warns user about mistake in command line. This solution also may be used in future for implementation of target specific arguments for another targets.