[PATCH] Implementation of R_ARM_TARGET1

Leny Kholodov leny.kholodov at gmail.com
Mon Mar 30 13:00:58 PDT 2015


Hi Bigcheese, ruiu, shankar.easwaran,

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:
1) general processing of target specific options inside the driver (GnuLdDriver.cpp): it passes all arguments from grp_targetopts group to the ELFLinkingContext::applyTargetSpecificArgument method;
2) printing warning about unknown target specific arguments in the implementation of ELFLinkingContext::applyTargetSpecificArgument;
3) 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.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8707

Files:
  include/lld/ReaderWriter/ELFLinkingContext.h
  lib/Driver/GnuLdDriver.cpp
  lib/Driver/GnuLdOptions.td
  lib/ReaderWriter/ELF/ARM/ARMLinkingContext.cpp
  lib/ReaderWriter/ELF/ARM/ARMLinkingContext.h
  lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp
  lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.h
  lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp
  lib/ReaderWriter/ELF/ELFLinkingContext.cpp
  test/elf/ARM/rel-target1.test
  test/elf/options/target-specific-args.test

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8707.22897.patch
Type: text/x-patch
Size: 12187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150330/06703d12/attachment.bin>


More information about the llvm-commits mailing list