<p dir="ltr">It should be checking the file format. I will fix that after lunch. Thanks.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Aug 24, 2016 1:52 PM, "Steven Wu" <<a href="mailto:stevenwu@apple.com">stevenwu@apple.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Rafael<br>
<br>
I run into a problem for this commit. See comment below.<br>
<div class="elided-text"><br>
> On May 27, 2016, at 3:41 PM, Rafael Espindola via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
> Author: rafael<br>
> Date: Fri May 27 17:41:51 2016<br>
> New Revision: 271066<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=271066&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=271066&view=rev</a><br>
> Log:<br>
> Start using shouldAssumeDSOLocal on ARM.<br>
><br>
> Given where this is used it should be a nop.<br>
><br>
> Modified:<br>
>    llvm/trunk/lib/Target/ARM/<wbr>ARMSubtarget.cpp<br>
><br>
> Modified: llvm/trunk/lib/Target/ARM/<wbr>ARMSubtarget.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=271066&r1=271065&r2=271066&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/Target/<wbr>ARM/ARMSubtarget.cpp?rev=<wbr>271066&r1=271065&r2=271066&<wbr>view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/lib/Target/ARM/<wbr>ARMSubtarget.cpp (original)<br>
> +++ llvm/trunk/lib/Target/ARM/<wbr>ARMSubtarget.cpp Fri May 27 17:41:51 2016<br>
> @@ -22,6 +22,7 @@<br>
> #include "Thumb1FrameLowering.h"<br>
> #include "Thumb1InstrInfo.h"<br>
> #include "Thumb2InstrInfo.h"<br>
> +#include "llvm/CodeGen/Analysis.h"<br>
> #include "llvm/CodeGen/<wbr>MachineRegisterInfo.h"<br>
> #include "llvm/IR/Attributes.h"<br>
> #include "llvm/IR/Function.h"<br>
> @@ -273,40 +274,19 @@ bool ARMSubtarget::isAAPCS16_ABI() const<br>
>   return TM.TargetABI == ARMBaseTargetMachine::ARM_ABI_<wbr>AAPCS16;<br>
> }<br>
><br>
> -<br>
> -/// GVIsIndirectSymbol - true if the GV will be accessed via an indirect symbol.<br>
> +/// true if the GV will be accessed via an indirect symbol.<br>
> bool<br>
> ARMSubtarget::<wbr>GVIsIndirectSymbol(const GlobalValue *GV,<br>
>                                  Reloc::Model RelocM) const {<br>
> -  if (RelocM == Reloc::Static)<br>
> -    return false;<br>
> -<br>
> -  bool isDef = GV-><wbr>isStrongDefinitionForLinker();<br>
> +  if (!shouldAssumeDSOLocal(RelocM, TargetTriple, *GV->getParent(), GV))<br>
> +    return true;<br>
><br>
> -  if (!isTargetMachO()) {<br>
> -    // Extra load is needed for all externally visible.<br>
> -    if (GV->hasLocalLinkage() || GV->hasHiddenVisibility())<br>
> -      return false;<br>
> +  // 32 bit macho has no relocation for a-b if a is undefined, even if b is in<br>
> +  // the section that is being relocated. This means we have to use o load even<br>
> +  // for GVs that are known to be local to the dso.<br>
> +  if (isTargetDarwin() && RelocM == Reloc::PIC_ &&<br>
> +      (GV->isDeclarationForLinker() || GV->hasCommonLinkage()))<br>
</div>Is there any specific reason using isTargetDarwin() instead of isTargetMachO()? This seems like a general limitation for MachO which is not specific to Darwin. When I compiling embedded architecture for MachO (armv7em), my target is not Darwin but it is still MachO (default triple is thumbv7em-apple-unknown-macho)<wbr>. I will get error like:<br>
fatal error: error in backend: symbol '*' can not be undefined in a subtraction expression<br>
<br>
Thanks<br>
<font color="#888888"><br>
Steven<br>
</font><div class="elided-text"><br>
>     return true;<br>
> -  } else {<br>
> -    // If this is a strong reference to a definition, it is definitely not<br>
> -    // through a stub.<br>
> -    if (isDef)<br>
> -      return false;<br>
> -<br>
> -    // Unless we have a symbol with hidden visibility, we have to go through a<br>
> -    // normal $non_lazy_ptr stub because this symbol might be resolved late.<br>
> -    if (!GV->hasHiddenVisibility())  // Non-hidden $non_lazy_ptr reference.<br>
> -      return true;<br>
> -<br>
> -    if (RelocM == Reloc::PIC_) {<br>
> -      // If symbol visibility is hidden, we have a stub for common symbol<br>
> -      // references and external declarations.<br>
> -      if (GV->isDeclarationForLinker() || GV->hasCommonLinkage())<br>
> -        // Hidden $non_lazy_ptr reference.<br>
> -        return true;<br>
> -    }<br>
> -  }<br>
><br>
>   return false;<br>
> }<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
<br>
</div></blockquote></div><br></div>