From: Ulrich Drepper Date: Fri, 30 Jan 1998 16:54:27 +0000 (+0000) Subject: Make sure the variable `reloc' is really kept as a variable. X-Git-Tag: cvs/before-sparc-2_0_x-branch~268 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acdcd9290fbe8826720bf7c4342dad092dc04e09;p=thirdparty%2Fglibc.git Make sure the variable `reloc' is really kept as a variable. --- diff --git a/elf/dl-open.c b/elf/dl-open.c index fe9f8ff017c..86b9c226736 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -1,5 +1,5 @@ /* Load a shared object at runtime, relocate it, and run its initializer. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 1998 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 @@ -73,6 +73,13 @@ _dl_open (const char *file, int mode) between when _dl_object_relocation_scope returns and when we enter the dynamic linker's code (_dl_relocate_object). */ __typeof (_dl_relocate_object) *reloc = &_dl_relocate_object; + + /* GCC is very clever. If we wouldn't add some magic it would + simply optimize away our nice little variable `reloc' and we + would result in a not working binary. So let's swing the + magic ward. */ + asm ("" : "=r" (reloc) : "0" (reloc)); + (*reloc) (l, _dl_object_relocation_scope (l), (mode & RTLD_BINDING_MASK) == RTLD_LAZY); *_dl_global_scope_end = NULL;