ARM: Fix R_ARM_IRELATIVE RELA relocations.

This patch fixes what I believe to be a bug in the handling of
R_ARM_IRELATIVE RELA relocations. At present, these are handled the
same as REL relocations: i.e. the addend is loaded from the relocation
address. Most of the time this isn't a problem because RELA relocations
aren't used on ARM (GNU/Linux at least) anyway, but it causes problems
with prelink, which uses RELA on all targets for its conflict table.
(Support for ifunc prelinking requires a prelink patch, not yet posted.)

Anyway, this patch works, though I'm not 100% sure if it is correct: I
notice that this code path received attention last year:

https://sourceware.org/ml/libc-ports/2013-07/msg00000.html

I'm not sure under what circumstances that patch would have had an
effect, nor if my patch conflicts with that case.

No regressions using Mentor's usual glibc cross-testing infrastructure.

	[BZ #16888]
	* sysdeps/arm/dl-machine.h (elf_machine_rela): Fix R_ARM_IRELATIVE
	handling.
This commit is contained in:
Julian Brown 2014-04-30 16:17:59 +00:00 committed by Joseph Myers
parent d0f5b3f851
commit 60c8f1f60b
3 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2014-04-30 Julian Brown <julian@codesourcery.com>
[BZ #16888]
* sysdeps/arm/dl-machine.h (elf_machine_rela): Fix R_ARM_IRELATIVE
handling.
2014-04-30 Joseph Myers <joseph@codesourcery.com>
[BZ #9894]

2
NEWS
View File

@ -15,7 +15,7 @@ Version 2.20
16632, 16634, 16639, 16642, 16648, 16649, 16670, 16674, 16677, 16680,
16683, 16689, 16695, 16701, 16706, 16707, 16712, 16713, 16714, 16731,
16739, 16740, 16743, 16754, 16758, 16759, 16760, 16770, 16786, 16789,
16791, 16799, 16800, 16815, 16823, 16824, 16831, 16838, 16854.
16791, 16799, 16800, 16815, 16823, 16824, 16831, 16838, 16854, 16888.
* The minimum Linux kernel version that this version of the GNU C Library
can be used with is 2.6.32.

View File

@ -594,7 +594,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
}
break;
case R_ARM_IRELATIVE:
value = map->l_addr + *reloc_addr;
value = map->l_addr + reloc->r_addend;
value = ((Elf32_Addr (*) (int)) value) (GLRO(dl_hwcap));
*reloc_addr = value;
break;