about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-07-14 15:10:51 +0000
committerUlrich Drepper <drepper@redhat.com>1999-07-14 15:10:51 +0000
commitc33bd0123ed605d201ee43dcd80998b6ab858022 (patch)
treeb6a80d68585492ea2b257a7fcd4b7f28873bebad
parentc68cb81185c18b59d974620c3679f90ee4f6c487 (diff)
downloadglibc-c33bd0123ed605d201ee43dcd80998b6ab858022.tar.gz
glibc-c33bd0123ed605d201ee43dcd80998b6ab858022.tar.xz
glibc-c33bd0123ed605d201ee43dcd80998b6ab858022.zip
Update.
1999-07-13  Andreas Schwab  <schwab@suse.de>

	* elf/dl-runtime.c (fixup, profile_fixup): Call alloca to prevent
	inlining.  Fixes PR libc/1198.
-rw-r--r--ChangeLog5
-rw-r--r--elf/dl-runtime.c12
2 files changed, 17 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b03ad40cc..064d5edd7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1999-07-13  Andreas Schwab  <schwab@suse.de>
+
+	* elf/dl-runtime.c (fixup, profile_fixup): Call alloca to prevent
+	inlining.  Fixes PR libc/1198.
+
 1999-07-14  Andreas Schwab  <schwab@suse.de>
 
 	* Makerules (common-generated): Don't prepend $(common-objpfx).
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index a0f54bd3fc..9f3004ecf5 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -57,6 +57,12 @@ fixup (
   void *const rel_addr = (void *)(l->l_addr + reloc->r_offset);
   ElfW(Addr) value;
 
+  /* The use of `alloca' here looks ridiculous but it helps.  The goal is
+     to prevent the function from being inlined and thus optimized out.
+     There is no official way to do this so we use this trick.  gcc never
+     inlines functions which use `alloca'.  */
+  alloca (sizeof (int));
+
   /* Sanity check that we're really looking at a PLT relocation.  */
   assert (ELFW(R_TYPE)(reloc->r_info) == ELF_MACHINE_JMP_SLOT);
 
@@ -110,6 +116,12 @@ profile_fixup (
   ElfW(Addr) *resultp;
   ElfW(Addr) value;
 
+  /* The use of `alloca' here looks ridiculous but it helps.  The goal is
+     to prevent the function from being inlined, and thus optimized out.
+     There is no official way to do this so we use this trick.  gcc never
+     inlines functions which use `alloca'.  */
+  alloca (sizeof (int));
+
   /* This is the address in the array where we store the result of previous
      relocations.  */
   resultp = &l->l_reloc_result[reloc_offset / sizeof (PLTREL)];