diff options
author | Kevin Enderby <enderby@apple.com> | 2013-12-04 23:36:24 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2013-12-04 23:36:24 +0000 |
commit | f50f3a3bb9001bbfbc8d392c2021f674c80f7b7c (patch) | |
tree | d0bc9f32fa3466d95a498232c315d11c64772077 /lib/Target/X86/MCTargetDesc | |
parent | 3f8689f8af4044afc9c940a1dc43ef6bc32bcdd7 (diff) | |
download | llvm-f50f3a3bb9001bbfbc8d392c2021f674c80f7b7c.tar.gz llvm-f50f3a3bb9001bbfbc8d392c2021f674c80f7b7c.tar.bz2 llvm-f50f3a3bb9001bbfbc8d392c2021f674c80f7b7c.tar.xz |
Fix a bug in darwin's 32-bit X86 handling of evaluating fixups.
Where it would use a scattered relocation entry but falls back to a
normal relocation entry because the FixupOffset is more than 24-bits.
The bug is in the X86MachObjectWriter::RecordScatteredRelocation() where
it changes reference parameter FixedValue but then returns false to indicate
it did not create a scattered relocation entry. The fix is simply to save the
original value of the parameter FixedValue at the start of the method and
restore it if we are returning false in that case.
rdar://15526046
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196432 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/MCTargetDesc')
-rw-r--r-- | lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp b/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp index eb7c0b1a99..0f16621b85 100644 --- a/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp @@ -362,6 +362,7 @@ bool X86MachObjectWriter::RecordScatteredRelocation(MachObjectWriter *Writer, MCValue Target, unsigned Log2Size, uint64_t &FixedValue) { + uint64_t OriginalFixedValue = FixedValue; uint32_t FixupOffset = Layout.getFragmentOffset(Fragment)+Fixup.getOffset(); unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind()); unsigned Type = MachO::GENERIC_RELOC_VANILLA; @@ -431,8 +432,10 @@ bool X86MachObjectWriter::RecordScatteredRelocation(MachObjectWriter *Writer, // symbol, things can go badly. // // Required for 'as' compatibility. - if (FixupOffset > 0xffffff) + if (FixupOffset > 0xffffff) { + FixedValue = OriginalFixedValue; return false; + } } MachO::any_relocation_info MRE; |