Skip to content

Commit

Permalink
Don't crash on unresolved weak symbol reference
Browse files Browse the repository at this point in the history
(cherry picked from commit 9acbe24)
  • Loading branch information
Andreas Schwab committed Jun 1, 2010
1 parent ea25a41 commit 6155a84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2010-05-19 Andreas Schwab <schwab@redhat.com>

* elf/dl-runtime.c (_dl_fixup): Don't crash on unresolved weak
symbol reference.

2010-05-21 Andreas Schwab <schwab@redhat.com>

* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add recvmmsg
Expand Down
7 changes: 4 additions & 3 deletions elf/dl-runtime.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* On-demand PLT fixup for shared objects.
Copyright (C) 1995-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Copyright (C) 1995-2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -144,7 +144,8 @@ _dl_fixup (
/* And now perhaps the relocation addend. */
value = elf_machine_plt_value (l, reloc, value);

if (__builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0))
if (sym != NULL
&& __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0))
value = ((DL_FIXUP_VALUE_TYPE (*) (void)) DL_FIXUP_VALUE_ADDR (value)) ();

/* Finally, fix up the plt itself. */
Expand Down Expand Up @@ -369,7 +370,7 @@ _dl_profile_fixup (
struct audit_ifaces *afct = GLRO(dl_audit);
for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
{
if (afct->ARCH_LA_PLTENTER != NULL
if (afct->ARCH_LA_PLTENTER != NULL
&& (reloc_result->enterexit
& (LA_SYMB_NOPLTENTER << (2 * (cnt + 1)))) == 0)
{
Expand Down

0 comments on commit 6155a84

Please sign in to comment.