llvm.org GIT mirror llvm / 3ef7edc
Do not add offset in applyFixup. This has already been accounted for in Value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154838 91177308-0d34-0410-b5e6-96231b3b80d8 Akira Hatanaka 7 years ago
2 changed file(s) with 25 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
1111 //===----------------------------------------------------------------------===//
1212 //
1313
14 #include "MipsBaseInfo.h"
1514 #include "MipsFixupKinds.h"
1615 #include "MCTargetDesc/MipsMCTargetDesc.h"
1716 #include "llvm/MC/MCAsmBackend.h"
8483 uint64_t Value) const {
8584 MCFixupKind Kind = Fixup.getKind();
8685 Value = adjustFixupValue((unsigned)Kind, Value);
87 int64_t SymOffset = MipsGetSymAndOffset(Fixup).second;
88
89 if (!Value && !SymOffset)
86
87 if (!Value)
9088 return; // Doesn't change encoding.
9189
9290 // Where do we start in the object
117115 }
118116
119117 uint64_t Mask = ((uint64_t)(-1) >> (64 - getFixupKindInfo(Kind).TargetSize));
120 CurVal |= (Value + SymOffset) & Mask;
118 CurVal |= Value & Mask;
121119
122120 // Write out the fixed up bytes back to the code/data bits.
123121 for (unsigned i = 0; i != NumBytes; ++i) {
0 ; RUN: llc -filetype=obj -mtriple mipsel-unknown-linux %s -o - | elf-dump --dump-section-data | FileCheck %s
1
2 ; FIXME: use assembler instead of llc when it becomes available.
3
4 @string1 = internal global [11 x i8] c"aaaaaaaaaa\00", align 1
5 @string2 = internal global [10 x i8] c"aaaa\00bbbb\00", align 1
6
7 define i32 @foo1(i32 %n) nounwind readonly {
8 entry:
9 ; check that the immediate fields of lwl and lwr are three apart.
10 ; 8841000e lwl at,14(v0)
11 ; 9841000b lwr at,11(v0)
12
13 ; CHECK: ('_section_data', '00001c3c 00009c27 21e09903 0000828f 0e004188 0b004198
14
15 %call = tail call i32 @memcmp(i8* getelementptr inbounds ([11 x i8]* @string1, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8]* @string2, i32 0, i32 0), i32 4) nounwind readonly
16 %cmp = icmp eq i32 %call, 0
17 %conv = zext i1 %cmp to i32
18 ret i32 %conv
19 }
20
21 declare i32 @memcmp(i8* nocapture, i8* nocapture, i32) nounwind readonly