[llvm-commits] [PATCH] ARM: conditional BL should use fixup_arm_condbranch

Jim Grosbach grosbach at apple.com
Wed Mar 21 16:06:10 PDT 2012


This should be handled in the ELF relocation code. The encoder is for more than just ELF and this will break Darwin horribly.

-Jim


On Mar 19, 2012, at 6:47 AM, Mans Rullgard <mans at mansr.com> wrote:

> Using fixup_arm_bl results in an R_ARM_CALL relocation which is not
> allowed for conditional BL instructions.
> ---
> lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp |    6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp b/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
> index 4445dcd..cf18508 100644
> --- a/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
> +++ b/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
> @@ -597,8 +597,12 @@ uint32_t ARMMCCodeEmitter::
> getARMBLTargetOpValue(const MCInst &MI, unsigned OpIdx,
>                           SmallVectorImpl<MCFixup> &Fixups) const {
>   const MCOperand MO = MI.getOperand(OpIdx);
> -  if (MO.isExpr())
> +  if (MO.isExpr()) {
> +    if (HasConditionalBranch(MI))
> +      return ::getBranchTargetOpValue(MI, OpIdx,
> +                                      ARM::fixup_arm_condbranch, Fixups);
>     return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_arm_bl, Fixups);
> +  }
> 
>   return MO.getImm() >> 2;
> }
> -- 
> 1.7.8.5
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list