[llvm-branch-commits] [llvm-branch] r228667 - Merging r228565:
Hans Wennborg
hans at hanshq.net
Mon Feb 9 19:52:36 PST 2015
Author: hans
Date: Mon Feb 9 21:52:36 2015
New Revision: 228667
URL: http://llvm.org/viewvc/llvm-project?rev=228667&view=rev
Log:
Merging r228565:
------------------------------------------------------------------------
r228565 | majnemer | 2015-02-08 22:31:31 -0800 (Sun, 08 Feb 2015) | 3 lines
MC: Calculate intra-section symbol differences correctly for COFF
This fixes PR22060.
------------------------------------------------------------------------
Modified:
llvm/branches/release_36/ (props changed)
llvm/branches/release_36/lib/MC/WinCOFFObjectWriter.cpp
llvm/branches/release_36/test/MC/COFF/diff.s
Propchange: llvm/branches/release_36/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb 9 21:52:36 2015
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226170-226171,226182,226473,226664,226708,226711,226755,226809,227005,227085,227250,227260-227261,227290,227294,227299,227319,227339,227491,227584,227603,227628,227670,227809,227815,227903,227934,227972,227983,228049,228129,228168,228331,228411,228444,228490,228500,228507,228518,228525
+/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226170-226171,226182,226473,226664,226708,226711,226755,226809,227005,227085,227250,227260-227261,227290,227294,227299,227319,227339,227491,227584,227603,227628,227670,227809,227815,227903,227934,227972,227983,228049,228129,228168,228331,228411,228444,228490,228500,228507,228518,228525,228565
Modified: llvm/branches/release_36/lib/MC/WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/lib/MC/WinCOFFObjectWriter.cpp?rev=228667&r1=228666&r2=228667&view=diff
==============================================================================
--- llvm/branches/release_36/lib/MC/WinCOFFObjectWriter.cpp (original)
+++ llvm/branches/release_36/lib/MC/WinCOFFObjectWriter.cpp Mon Feb 9 21:52:36 2015
@@ -710,17 +710,22 @@ void WinCOFFObjectWriter::RecordRelocati
CrossSection = &Symbol.getSection() != &B->getSection();
// Offset of the symbol in the section
- int64_t a = Layout.getSymbolOffset(&B_SD);
+ int64_t OffsetOfB = Layout.getSymbolOffset(&B_SD);
- // Offset of the relocation in the section
- int64_t b = Layout.getFragmentOffset(Fragment) + Fixup.getOffset();
-
- FixedValue = b - a;
// In the case where we have SymbA and SymB, we just need to store the delta
// between the two symbols. Update FixedValue to account for the delta, and
// skip recording the relocation.
- if (!CrossSection)
+ if (!CrossSection) {
+ int64_t OffsetOfA = Layout.getSymbolOffset(&A_SD);
+ FixedValue = (OffsetOfA - OffsetOfB) + Target.getConstant();
return;
+ }
+
+ // Offset of the relocation in the section
+ int64_t OffsetOfRelocation =
+ Layout.getFragmentOffset(Fragment) + Fixup.getOffset();
+
+ FixedValue = OffsetOfRelocation - OffsetOfB;
} else {
FixedValue = Target.getConstant();
}
Modified: llvm/branches/release_36/test/MC/COFF/diff.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/test/MC/COFF/diff.s?rev=228667&r1=228666&r2=228667&view=diff
==============================================================================
--- llvm/branches/release_36/test/MC/COFF/diff.s (original)
+++ llvm/branches/release_36/test/MC/COFF/diff.s Mon Feb 9 21:52:36 2015
@@ -1,5 +1,23 @@
// RUN: llvm-mc -filetype=obj -triple i686-pc-mingw32 %s | llvm-readobj -s -sr -sd | FileCheck %s
+.section baz, "xr"
+ .def X
+ .scl 2;
+ .type 32;
+ .endef
+ .globl X
+X:
+ mov Y-X+42, %eax
+ retl
+
+ .def Y
+ .scl 2;
+ .type 32;
+ .endef
+ .globl Y
+Y:
+ retl
+
.def _foobar;
.scl 2;
.type 32;
@@ -30,3 +48,10 @@ _rust_crate:
// CHECK: SectionData (
// CHECK-NEXT: 0000: 00000000 00000000 1C000000 20000000
// CHECK-NEXT: )
+
+// CHECK: Name: baz
+// CHECK: Relocations [
+// CHECK-NEXT: ]
+// CHECK: SectionData (
+// CHECK-NEXT: 0000: A1300000 00C3C3
+// CHECK-NEXT: )
More information about the llvm-branch-commits
mailing list