hppa: avoid NULL dereference of sym_map in elf_machine_rela()

Message ID 20141031223801.GA17511@drone.musicnaut.iki.fi
State Committed

Commit Message

Aaro Koskinen Oct. 31, 2014, 10:38 p.m. UTC
  On Fri, Oct 31, 2014 at 02:42:55PM -0700, Roland McGrath wrote:
> It's likely this is not the right fix.  Unless there is a test case where
> any of those paths can actually dereference a null pointer, then we do not
> want to insert those checks.

Ok, let's call it a quick hack/workaround then.

> Rather, the right solution is probably to find (or add) some switch to GCC
> that changes what it emits from being a call to abort to be something
> different.  It's possible that abort is OK and we just need to define an
> appropriately minimal abort in rtld.  But it needs to be looked into.

The other quick workaround I could find is -fno-delete-null-pointer-checks.

"[...] other optimization passes in GCC use this flag to control global
dataflow analyses that eliminate useless checks for null pointers [...]"

So this also fixes the PA-RISC build:



diff --git a/elf/Makefile b/elf/Makefile
index 3036b9b..f5fee93 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -46,6 +46,7 @@  shared-only-routines += dl-caller
 rtld-routines	:= rtld $(dl-routines) dl-sysdep dl-environ dl-minimal
 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
+CFLAGS-dl-conflict.c = -fno-delete-null-pointer-checks
 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)