aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/powerpc/libc-start.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/powerpc/libc-start.c')
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/libc-start.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
index bb97d16145..8413c84783 100644
--- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c
+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
@@ -23,6 +23,10 @@
#ifndef SHARED
#include <hwcapinfo.h>
#endif
+#if ENABLE_STATIC_PIE && !defined SHARED
+/* For elf_machine_load_address. */
+#include <dl-machine.h>
+#endif
/* The main work is done in the generic function. */
#define LIBC_START_MAIN generic_start_main
@@ -95,8 +99,15 @@ __libc_start_main_impl (int argc, char **argv,
__tcb_parse_hwcap_and_convert_at_platform ();
#endif
- return generic_start_main (stinfo->main, argc, argv, auxvec,
- stinfo->init, stinfo->fini, rtld_fini,
+ void *stmain = stinfo->main;
+#if ENABLE_STATIC_PIE && !defined SHARED
+ struct link_map *map = _dl_get_dl_main_map ();
+ if (!map->l_relocated)
+ stmain = (char *) stmain + elf_machine_load_address ();
+#endif
+
+ return generic_start_main (stmain, argc, argv, auxvec,
+ NULL, NULL, rtld_fini,
stack_on_entry);
}
DEFINE_LIBC_START_MAIN_VERSION