Commit Graph

3 Commits

Author SHA1 Message Date
Rafael Espindola f846ce259a Fix weak symbols on arm and aarch64.
Given

.weak target
 .global _start
_start:
 b target

The intention is that the branch goes to the instruction after the
branch, effectively turning it on a nop.  The branch adds the runtime
PC, but we were adding it statically too.

I noticed the oddity by inspection, but llvm-objdump seems to agree,
since it now prints things like:

b       #-4 <_start+0x4>

llvm-svn: 305212
2017-06-12 18:05:01 +00:00
Rafael Espindola d2a1b944bc Don't check the raw bits in tests.
It is not needed since we have the disassemble.

llvm-svn: 305096
2017-06-09 18:07:34 +00:00
Peter Smith 8339bbd759 [ELF] ARM and AArch64 undefined weak reference values
The ARM 32 and 64-bit ABI does not use 0 for undefined weak references
that are used in PC relative relocations. In particular:
- A branch relocation to an undefined weak resolves to the next
  instruction. Effectively making the branch a no-op
- In all other cases the symbol resolves to the place so that S + A - P
  resolves to A.

Differential Revision: https://reviews.llvm.org/D26240

llvm-svn: 286353
2016-11-09 10:22:29 +00:00