Don't apply a relocation if we create a dynamic reloc.

With RELA that is just wasteful, with REL the relocation gets applied
twice.

llvm-svn: 248795
This commit is contained in:
Rafael Espindola 2015-09-29 13:51:43 +00:00
parent 5edd83de91
commit be901e2dbc
2 changed files with 8 additions and 0 deletions

View File

@ -60,6 +60,8 @@ void InputSection<ELFT>::relocate(
} else if (Target->relocPointsToGot(Type)) {
SymVA = GotSec.getVA();
Type = Target->getPCRelReloc();
} else if (isa<SharedSymbol<ELFT>>(Body)) {
continue;
}
}

View File

@ -57,3 +57,9 @@ R_386_GOTPC:
// CHECK: Disassembly of section .R_386_GOTPC:
// CHECK-NEXT: R_386_GOTPC:
// CHECK-NEXT: 11014: {{.*}} movl $16364, %eax
.section .dynamic_reloc, "ax",@progbits
call bar+4
// CHECK: Disassembly of section .dynamic_reloc:
// CHECK-NEXT: .dynamic_reloc:
// CHECK-NEXT: 11019: e8 00 00 00 00 calll 0