Don't produce relocations for a difference in a section with no symbols.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 4 Nov 2014 22:10:33 +0000 (22:10 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 4 Nov 2014 22:10:33 +0000 (22:10 +0000)
commitc32606704029c3b8bef45e55dd6f5c3bc54f2d56
tree474de2c82a97c4569ed092c7f8ae03a206907a1d
parent1aa0694c0345998856be289ee03f8b8a8e867368
Don't produce relocations for a difference in a section with no symbols.

We were producing a relocation for
----------------
.section foo,bar
La:
Lb:
 .long   La-Lb
--------------

but not for

---------------------
  .section foo,bar
zed:
La:
Lb:
 .long   La-Lb
----------------

This patch handles the case where both fragments are part of the first atom
in a section and there is no corresponding symbol to that atom.

This fixes pr21328.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221304 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/MachObjectWriter.cpp
test/MC/MachO/darwin-x86_64-diff-reloc-assign-2.s
test/MC/X86/reloc-macho.s [new file with mode: 0644]