mirror of
https://review.haiku-os.org/buildtools
synced 2024-11-23 07:18:49 +01:00
circumvent the newer BeOS loader instability when it has to deal
with R_386_NONE reloc-entries with zero offset. git-svn-id: file:///srv/svn/repos/haiku/trunk/buildtools@9574 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2a516d7eb9
commit
403ef65902
@ -2311,10 +2311,32 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
/* r_symndx will be zero only for relocs against symbols
|
||||
from removed linkonce sections, or sections discarded by
|
||||
a linker script. */
|
||||
if (r_symndx == 0
|
||||
|| (input_section->flags & SEC_ALLOC) == 0)
|
||||
break;
|
||||
{
|
||||
bfd_boolean skip, relocate;
|
||||
skip = FALSE;
|
||||
relocate = FALSE;
|
||||
|
||||
/* [zooey]: the dynamic loader of newer BeOS versions (BONE,Dano,Zeta)
|
||||
is broken to such an extent that crashes when it encounters
|
||||
a R_386_NONE reloc entry with a zero offset. In order to
|
||||
circumvent this bug, I changed the skip-handling below
|
||||
such that it keeps the original offset (of the now defunct
|
||||
relocation target) in place. This way, the loader
|
||||
accepts it (and ignores this reloc entry, as it should). */
|
||||
if (r_symndx == 0)
|
||||
skip = TRUE;
|
||||
#if 0
|
||||
if (r_symndx == 0)
|
||||
{
|
||||
/* Zero the section contents as a hint to unwinders and
|
||||
other consumers of exception handling info that this
|
||||
entry is invalid. */
|
||||
bfd_put_32 (input_bfd, 0, contents + rel->r_offset);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if ((input_section->flags & SEC_ALLOC) == 0)
|
||||
break;
|
||||
if ((info->shared
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
@ -2335,16 +2357,12 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
bfd_byte *loc;
|
||||
bfd_boolean skip, relocate;
|
||||
asection *sreloc;
|
||||
|
||||
/* When generating a shared object, these relocations
|
||||
are copied into the output file to be resolved at run
|
||||
time. */
|
||||
|
||||
skip = FALSE;
|
||||
relocate = FALSE;
|
||||
|
||||
outrel.r_offset =
|
||||
_bfd_elf_section_offset (output_bfd, info, input_section,
|
||||
rel->r_offset);
|
||||
@ -2356,7 +2374,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
+ input_section->output_offset);
|
||||
|
||||
if (skip)
|
||||
memset (&outrel, 0, sizeof outrel);
|
||||
outrel.r_info = ELF32_R_INFO (0, R_386_NONE);
|
||||
else if (h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& (r_type == R_386_PC32
|
||||
@ -2388,7 +2406,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
case R_386_TLS_IE:
|
||||
if (info->shared)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user