This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Remove dead cruft from crtstuff.c (take 2)
- To: "H . J . Lu" <hjl at lucon dot org>
- Subject: [PATCH] Remove dead cruft from crtstuff.c (take 2)
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 16 Mar 2001 18:08:16 +0100
- Cc: rth at redhat dot com, gcc-patches at gcc dot gnu dot org
- References: <20010316120131.F574@sunsite.ms.mff.cuni.cz> <20010316075107.B31912@lucon.org>
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
On Fri, Mar 16, 2001 at 07:51:07AM -0800, H . J . Lu wrote:
> On Fri, Mar 16, 2001 at 12:01:31PM +0100, Jakub Jelinek wrote:
> > Hi!
> >
> > As result of recent atexit changes in glibc using atexit in i386-linux
> > crtendS.o is bad (since if the shared library does not use atexit, it won't
> > be taken from libc_nonshared and shared library will thus end up with
> > non-versioned atexit reference).
> > According to H.J., this kludge was needed only for very very old Linux C
> > libraries and can be safely killed.
> > Ok to commit?
> >
>
> How about this patch? The old libc still needs it.
In that case, isn't it better to move it out of crtstuff.c into target
headers?
2001-03-16 Jakub Jelinek <jakub@redhat.com>
* crtstuff.c (init_dummy): Use CRT_END_INIT_DUMMY if defined.
Remove ia32 linux PIC kludge and move it...
* config/i386/linux.h (CRT_END_INIT_DUMMY): ...here.
--- gcc/config/i386/linux.h.jj Mon Mar 12 11:45:15 2001
+++ gcc/config/i386/linux.h Fri Mar 16 18:52:31 2001
@@ -170,3 +170,21 @@ Boston, MA 02111-1307, USA. */
} \
} while (0)
#endif
+
+#if defined(__PIC__) && defined (USE_GNULIBC_1)
+/* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
+ __environ and atexit (). We have to make sure they are in the .dynsym
+ section. We accomplish it by making a dummy call here. This
+ code is never reached. */
+
+#define CRT_END_INIT_DUMMY \
+ do \
+ { \
+ extern void *___brk_addr; \
+ extern char **__environ; \
+ \
+ ___brk_addr = __environ; \
+ atexit (0); \
+ } \
+ while (0)
+#endif
--- gcc/crtstuff.c.jj Thu Mar 15 10:55:50 2001
+++ gcc/crtstuff.c Thu Mar 15 11:04:03 2001
@@ -414,20 +414,8 @@ init_dummy (void)
FORCE_INIT_SECTION_ALIGN;
#endif
asm (TEXT_SECTION_ASM_OP);
-
-/* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr,
- __environ and atexit (). We have to make sure they are in the .dynsym
- section. We accomplish it by making a dummy call here. This
- code is never reached. */
-
-#if defined(__linux__) && defined(__PIC__) && defined(__i386__)
- {
- extern void *___brk_addr;
- extern char **__environ;
-
- ___brk_addr = __environ;
- atexit (0);
- }
+#ifdef CRT_END_INIT_DUMMY
+ CRT_END_INIT_DUMMY;
#endif
}
Jakub