summaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-31 13:33:18 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-31 13:33:18 +0000
commit32c075e1f01849e161724bbd400ba77244e482cc (patch)
tree5f083a3f352104f32bb6c902d57fa3f294bd8d4d /stdlib
parentd6220e9ee38c1c9285221b023346201ec5f511b3 (diff)
.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/Makefile4
-rw-r--r--stdlib/atexit.c11
-rw-r--r--stdlib/cxa_finalize.c4
-rw-r--r--stdlib/stdlib.h16
4 files changed, 21 insertions, 14 deletions
diff --git a/stdlib/Makefile b/stdlib/Makefile
index b4518b2bb3..ecda85b0dd 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -104,6 +104,10 @@ CFLAGS-strfmon.c = -D_IO_MTSAFE_IO
CFLAGS-strfmon_l.c = -D_IO_MTSAFE_IO
endif
+ifeq (yes,$(have-protected))
+CFLAGS-atexit.c = -DHAVE_DOT_HIDDEN
+endif
+
CFLAGS-tst-bsearch.c = $(stack-align-test-flags)
CFLAGS-tst-qsort.c = $(stack-align-test-flags)
diff --git a/stdlib/atexit.c b/stdlib/atexit.c
index 256c5fcfc0..307662bdcd 100644
--- a/stdlib/atexit.c
+++ b/stdlib/atexit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1999, 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1999, 2001 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
@@ -43,11 +43,14 @@ extern void *__dso_handle __attribute__ ((__weak__));
/* Register FUNC to be executed by `exit'. */
int
-#ifndef atexit
-attribute_hidden
-#endif
atexit (void (*func) (void))
{
return __cxa_atexit ((void (*) (void *)) func, NULL,
&__dso_handle == NULL ? NULL : __dso_handle);
}
+
+/* Hide the symbol so that no definition but the one locally in the
+ executable or DSO is used. */
+#ifdef HAVE_DOT_HIDDEN
+asm (".hidden\tatexit");
+#endif
diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c
index 148d57f200..bb49f36ddd 100644
--- a/stdlib/cxa_finalize.c
+++ b/stdlib/cxa_finalize.c
@@ -45,8 +45,8 @@ __cxa_finalize (void *d)
/* We don't want to run this cleanup more than once. */
&& (cxafn = f->func.cxa.fn,
cxaarg = f->func.cxa.arg,
- ! catomic_compare_and_exchange_bool_acq (&f->flavor, ef_free,
- ef_cxa)))
+ ! atomic_compare_and_exchange_bool_acq (&f->flavor, ef_free,
+ ef_cxa)))
{
uint64_t check = __new_exitfn_called;
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 7b39bc018a..fd81cf9e5b 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2003,2004,2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2003,2004,2005,2006,2007 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
@@ -741,18 +741,18 @@ __END_NAMESPACE_STD
#ifdef __USE_GNU
/* Return a malloc'd string containing the canonical absolute name of the
- existing named file. */
+ named file. The last file name component need not exist, and may be a
+ symlink to a nonexistent file. */
extern char *canonicalize_file_name (__const char *__name)
__THROW __nonnull ((1)) __wur;
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
-/* Return the canonical absolute name of file NAME. The last file name
- component need not exist, and may be a symlink to a nonexistent file.
- If RESOLVED is null, the result is malloc'd; otherwise, if the canonical
- name is PATH_MAX chars or more, returns null with `errno' set to
- ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, returns the
- name in RESOLVED. */
+/* Return the canonical absolute name of file NAME. If RESOLVED is
+ null, the result is malloc'd; otherwise, if the canonical name is
+ PATH_MAX chars or more, returns null with `errno' set to
+ ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
+ returns the name in RESOLVED. */
extern char *realpath (__const char *__restrict __name,
char *__restrict __resolved) __THROW __wur;
#endif