mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-03 06:33:51 +08:00
6025c399e9
* sysdeps/alpha/memchr.S: new file. * sysdeps/alpha/memchr.c: obsolete file removed. Sat Mar 16 16:26:09 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> * misc/Makefile (headers): Add sysexits.h. * misc/sysexits.h: New file. Thu Mar 14 15:20:45 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/libm-ieee754/e_atan2.c (__ieee754_atan2): Change atan call to __atan. * sysdeps/libm-ieee754/e_atan2f.c (__ieee754_atan2f): Change atanf call to __atanf. * sysdeps/m68k/fpu/e_acos.c, sysdeps/m68k/fpu/e_acosf.c, sysdeps/m68k/fpu/e_asin.c, sysdeps/m68k/fpu/e_asinf.c, sysdeps/m68k/fpu/e_atanh.c, sysdeps/m68k/fpu/e_atanhf.c, sysdeps/m68k/fpu/e_cosh.c, sysdeps/m68k/fpu/e_coshf.c, sysdeps/m68k/fpu/e_exp.c, sysdeps/m68k/fpu/e_expf.c, sysdeps/m68k/fpu/e_fmod.c, sysdeps/m68k/fpu/e_fmodf.c, sysdeps/m68k/fpu/e_log.c, sysdeps/m68k/fpu/e_log10.c, sysdeps/m68k/fpu/e_log10f.c, sysdeps/m68k/fpu/e_logf.c, sysdeps/m68k/fpu/e_pow.c, sysdeps/m68k/fpu/e_powf.c, sysdeps/m68k/fpu/e_remainder.c, sysdeps/m68k/fpu/e_remainderf.c, sysdeps/m68k/fpu/e_scalb.c, sysdeps/m68k/fpu/e_scalbf.c, sysdeps/m68k/fpu/e_sinh.c, sysdeps/m68k/fpu/e_sinhf.c, sysdeps/m68k/fpu/e_sqrt.c, sysdeps/m68k/fpu/e_sqrtf.c, sysdeps/m68k/fpu/k_cos.c, sysdeps/m68k/fpu/k_cosf.c, sysdeps/m68k/fpu/k_sin.c, sysdeps/m68k/fpu/k_sinf.c, sysdeps/m68k/fpu/k_tan.c, sysdeps/m68k/fpu/k_tanf.c, sysdeps/m68k/fpu/s_atan.c, sysdeps/m68k/fpu/s_atanf.c, sysdeps/m68k/fpu/s_ceil.c, sysdeps/m68k/fpu/s_ceilf.c, sysdeps/m68k/fpu/s_cos.c, sysdeps/m68k/fpu/s_cosf.c, sysdeps/m68k/fpu/s_expm1.c, sysdeps/m68k/fpu/s_expm1f.c, sysdeps/m68k/fpu/s_fabs.c, sysdeps/m68k/fpu/s_fabsf.c, sysdeps/m68k/fpu/s_finite.c, sysdeps/m68k/fpu/s_finitef.c, sysdeps/m68k/fpu/s_floor.c, sysdeps/m68k/fpu/s_floorf.c, sysdeps/m68k/fpu/s_frexp.c, sysdeps/m68k/fpu/s_frexpf.c, sysdeps/m68k/fpu/s_ilogb.c, sysdeps/m68k/fpu/s_ilogbf.c, sysdeps/m68k/fpu/s_isinf.c, sysdeps/m68k/fpu/s_isinff.c, sysdeps/m68k/fpu/s_isnan.c, sysdeps/m68k/fpu/s_isnanf.c, sysdeps/m68k/fpu/s_ldexp.c, sysdeps/m68k/fpu/s_ldexpf.c, sysdeps/m68k/fpu/s_log1p.c, sysdeps/m68k/fpu/s_log1pf.c, sysdeps/m68k/fpu/s_logb.c, sysdeps/m68k/fpu/s_logbf.c, sysdeps/m68k/fpu/s_modf.c, sysdeps/m68k/fpu/s_modff.c, sysdeps/m68k/fpu/s_rint.c, sysdeps/m68k/fpu/s_rintf.c, sysdeps/m68k/fpu/s_scalbn.c, sysdeps/m68k/fpu/s_scalbnf.c, sysdeps/m68k/fpu/s_significand.c, sysdeps/m68k/fpu/s_significandf.c, sysdeps/m68k/fpu/s_sin.c, sysdeps/m68k/fpu/s_sinf.c, sysdeps/m68k/fpu/s_tan.c, sysdeps/m68k/fpu/s_tanf.c, sysdeps/m68k/fpu/s_tanh.c, sysdeps/m68k/fpu/s_tanhf.c: New files, for m68881 port of fdlibm. * sysdeps/m68k/fpu/__math.h: Rewritten for fdlibm. * sysdeps/m68k/fpu/isinfl.c: Rewritten to get argument type right. * sysdeps/m68k/fpu/isnanl.c: Likewise. Thu Mar 14 06:01:07 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> * posix/glob.c (glob): In GLOB_BRACE brace expansion, fix buffer size calculation to include trailing invariant portion. Don't use alloca; instead use a dynamic auto array for GCC, malloc for non-GCC. Handle nested braces properly. * elf/elf.h (Elf32_auxv_t): Specify prototype (void) for `a_un.a_fcn'. * libc-symbols.h (lint): New macro. Fri Mar 15 01:18:00 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * libio/iosetvbuf.c: Add weak alias setvbuf.
278 lines
9.1 KiB
C
278 lines
9.1 KiB
C
/* Support macros for making weak and strong aliases for symbols,
|
||
and for using symbol sets and linker warnings with GNU ld.
|
||
Copyright (C) 1995, 1996 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
|
||
modify it under the terms of the GNU Library General Public License as
|
||
published by the Free Software Foundation; either version 2 of the
|
||
License, or (at your option) any later version.
|
||
|
||
The GNU C Library is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
Library General Public License for more details.
|
||
|
||
You should have received a copy of the GNU Library General Public
|
||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||
Cambridge, MA 02139, USA. */
|
||
|
||
#ifndef _LIBC_SYMBOLS_H
|
||
#define _LIBC_SYMBOLS_H
|
||
|
||
/* This file's macros are included implicitly in the compilation of every
|
||
file in the C library by -imacros.
|
||
|
||
We include config.h which is generated by configure.
|
||
It should define for us the following symbols:
|
||
|
||
* HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out,
|
||
and for symbol set and warning messages extensions in a.out and ELF.
|
||
This implies HAVE_WEAK_SYMBOLS; set by --with-gnu-ld.
|
||
* HAVE_ELF if using ELF, which supports weak symbols.
|
||
This implies HAVE_WEAK_SYMBOLS; set by --with-elf.
|
||
|
||
* HAVE_WEAK_SYMBOLS if weak symbols are available in the assembler and
|
||
linker being used. Set by --with-weak-symbols.
|
||
|
||
*/
|
||
|
||
/* This is defined for the compilation of all C library code. features.h
|
||
tests this to avoid inclusion of stubs.h while compiling the library,
|
||
before stubs.h has been generated. Some library code that is shared
|
||
with other packages also tests this symbol to see if it is being
|
||
compiled as part of the C library. We must define this before including
|
||
config.h, because it makes some definitions conditional on whether libc
|
||
itself is being compiled, or just some generator program. */
|
||
#define _LIBC 1
|
||
|
||
#include <config.h>
|
||
|
||
/* This disables sccsid/rcsid strings in lots of code of non-GNU origin. */
|
||
#define lint 1
|
||
/*
|
||
|
||
*/
|
||
|
||
#ifndef ASSEMBLER
|
||
|
||
/* Define the macros `_' and `N_' for conveniently marking translatable
|
||
strings in the libc source code. */
|
||
|
||
#define N_(msgid) msgid
|
||
|
||
#include <libintl.h>
|
||
extern const char _libc_intl_domainname[];
|
||
|
||
#ifdef dgettext
|
||
/* This is defined as an optimizing macro, so use it. */
|
||
#define _(msgid) dgettext (_libc_intl_domainname, (msgid))
|
||
#else
|
||
/* Be sure to use only the __ name when `dgettext' is a plain function
|
||
instead of an optimizing macro. */
|
||
#define _(msgid) __dgettext (_libc_intl_domainname, (msgid))
|
||
#endif
|
||
|
||
#endif
|
||
|
||
/*
|
||
|
||
*/
|
||
/* The symbols in all the user (non-_) macros are C symbols. Predefined
|
||
should be HAVE_WEAK_SYMBOLS and/or HAVE_ELF and/or HAVE_GNU_LD.
|
||
HAVE_WEAK_SYMBOLS is implied by the other two. HAVE_GNU_LD without
|
||
HAVE_ELF implies a.out. */
|
||
|
||
#ifndef HAVE_WEAK_SYMBOLS
|
||
#if defined (HAVE_ELF) || defined (HAVE_GNU_LD)
|
||
#define HAVE_WEAK_SYMBOLS
|
||
#endif
|
||
#endif
|
||
|
||
#ifndef __SYMBOL_PREFIX
|
||
#ifdef HAVE_ELF
|
||
#define NO_UNDERSCORES
|
||
#else
|
||
#include <sysdep.h> /* Should define NO_UNDERSCORES. */
|
||
#endif
|
||
#ifdef NO_UNDERSCORES
|
||
#define __SYMBOL_PREFIX
|
||
#else
|
||
#define __SYMBOL_PREFIX "_"
|
||
#endif
|
||
#endif
|
||
|
||
#ifndef C_SYMBOL_NAME
|
||
#ifdef NO_UNDERSCORES
|
||
#define C_SYMBOL_NAME(name) name
|
||
#else
|
||
#define C_SYMBOL_NAME(name) _##name
|
||
#endif
|
||
#endif
|
||
|
||
|
||
/* Define ALIAS as a strong alias for ORIGINAL. */
|
||
#ifdef HAVE_ASM_SET_DIRECTIVE
|
||
#define strong_alias_asm(original, alias) \
|
||
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias); \
|
||
.set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
|
||
#ifdef ASSEMBLER
|
||
#define strong_alias(original, alias) strong_alias_asm (original, alias)
|
||
#else
|
||
#define strong_alias(original, alias) \
|
||
asm (__string_1 (ASM_GLOBAL_DIRECTIVE) " " __SYMBOL_PREFIX #alias "\n" \
|
||
".set " __SYMBOL_PREFIX #alias "," __SYMBOL_PREFIX #original);
|
||
#endif
|
||
#else
|
||
#define strong_alias_asm(original, alias) \
|
||
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias); \
|
||
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
|
||
#ifdef ASSEMBLER
|
||
#define strong_alias(original, alias) strong_alias_asm (original, alias)
|
||
#else
|
||
#define strong_alias(original, alias) \
|
||
asm (__string_1 (ASM_GLOBAL_DIRECTIVE) " " __SYMBOL_PREFIX #alias "\n" \
|
||
__SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original);
|
||
#endif
|
||
#endif
|
||
|
||
/* Helper macros used above. */
|
||
#define __string_1(x) __string_0(x)
|
||
#define __string_0(x) #x
|
||
|
||
|
||
#ifdef HAVE_WEAK_SYMBOLS
|
||
#ifdef ASSEMBLER
|
||
|
||
/* Define ALIAS as a weak alias for ORIGINAL.
|
||
If weak aliases are not available, this defines a strong alias. */
|
||
#define weak_alias(original, alias) \
|
||
.weak C_SYMBOL_NAME (alias); \
|
||
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
|
||
|
||
/* Declare SYMBOL to be weak. */
|
||
#define weak_symbol(symbol) .weak C_SYMBOL_NAME (symbol)
|
||
|
||
#else
|
||
#define weak_symbol(symbol) asm (".weak " __SYMBOL_PREFIX #symbol);
|
||
#define weak_alias(original, alias) \
|
||
asm (".weak " __SYMBOL_PREFIX #alias "\n" \
|
||
__SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original);
|
||
#endif
|
||
#else
|
||
#define weak_alias(original, alias) strong_alias(original, alias)
|
||
#define weak_symbol(symbol) /* Do nothing. */
|
||
#endif
|
||
|
||
|
||
#if (!defined (ASSEMBLER) && \
|
||
(__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)))
|
||
/* GCC 2.8 and later has special syntax for weak symbols and aliases.
|
||
Using that is better when possible, because the compiler and assembler
|
||
are better clued in to what we are doing. */
|
||
#undef strong_alias
|
||
#define strong_alias(name, aliasname) \
|
||
__typeof (name) aliasname __attribute__ ((alias (#name)));
|
||
|
||
#ifdef HAVE_WEAK_SYMBOLS
|
||
#undef weak_symbol
|
||
#define weak_symbol(name) \
|
||
extern __typeof (name) name __attribute__ ((weak));
|
||
#undef weak_alias
|
||
#define weak_alias(name, aliasname) \
|
||
__typeof (name) aliasname __attribute__ ((weak, alias (#name)));
|
||
#endif /* HAVE_WEAK_SYMBOLS. */
|
||
#endif /* Not ASSEMBLER, and GCC 2.8 or later. */
|
||
|
||
|
||
|
||
/* When a reference to SYMBOL is encountered, the linker will emit a
|
||
warning message MSG. */
|
||
#ifdef HAVE_GNU_LD
|
||
#ifdef HAVE_ELF
|
||
#define link_warning(symbol, msg) \
|
||
static const char __evoke_link_warning_##symbol[] \
|
||
__attribute__ ((section (".gnu.warning." #symbol))) = msg;
|
||
#else
|
||
#define link_warning(symbol, msg) \
|
||
asm(".stabs \"" msg "\",30,0,0,0\n" \
|
||
".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n");
|
||
#endif
|
||
#else
|
||
/* We will never be heard; they will all die horribly. */
|
||
#define link_warning(symbol, msg)
|
||
#endif
|
||
|
||
/* A canned warning for sysdeps/stub functions. */
|
||
#define stub_warning(name) \
|
||
link_warning (name, \
|
||
"warning: " #name " is not implemented and will always fail")
|
||
|
||
/*
|
||
|
||
*/
|
||
|
||
#ifdef HAVE_GNU_LD
|
||
|
||
/* Symbol set support macros. */
|
||
|
||
#ifdef HAVE_ELF
|
||
|
||
/* Make SYMBOL, which is in the text segment, an element of SET. */
|
||
#define text_set_element(set, symbol) _elf_set_element(set, symbol)
|
||
/* Make SYMBOL, which is in the data segment, an element of SET. */
|
||
#define data_set_element(set, symbol) _elf_set_element(set, symbol)
|
||
/* Make SYMBOL, which is in the bss segment, an element of SET. */
|
||
#define bss_set_element(set, symbol) _elf_set_element(set, symbol)
|
||
|
||
/* These are all done the same way in ELF.
|
||
There is a new section created for each set. */
|
||
#ifdef PIC
|
||
/* When building a shared library, make the set section writable,
|
||
because it will need to be relocated at run time anyway. */
|
||
#define _elf_set_element(set, symbol) \
|
||
static const void *__elf_set_##set##_element_##symbol##__ \
|
||
__attribute__ ((unused, section (#set))) = &(symbol)
|
||
#else
|
||
#define _elf_set_element(set, symbol) \
|
||
static const void *const __elf_set_##set##_element_##symbol##__ \
|
||
__attribute__ ((unused, section (#set))) = &(symbol)
|
||
#endif
|
||
|
||
/* Define SET as a symbol set. This may be required (it is in a.out) to
|
||
be able to use the set's contents. */
|
||
#define symbol_set_define(set) symbol_set_declare(set)
|
||
|
||
/* Declare SET for use in this module, if defined in another module. */
|
||
#define symbol_set_declare(set) \
|
||
extern void *const __start_##set __attribute__ ((__weak__)); \
|
||
extern void *const __stop_##set __attribute__ ((__weak__)); \
|
||
/* Gratuitously repeat weak decl, in case using broken GCC (<2.8). */\
|
||
weak_symbol (__start_##set) weak_symbol (__stop_##set)
|
||
|
||
/* Return a pointer (void *const *) to the first element of SET. */
|
||
#define symbol_set_first_element(set) (&__start_##set)
|
||
|
||
/* Return true iff PTR (a void *const *) has been incremented
|
||
past the last element in SET. */
|
||
#define symbol_set_end_p(set, ptr) ((ptr) >= &__stop_##set)
|
||
|
||
#else /* Not ELF: a.out. */
|
||
|
||
#define text_set_element(set, symbol) \
|
||
asm(".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol)
|
||
#define data_set_element(set, symbol) \
|
||
asm(".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol)
|
||
#define bss_set_element(set, symbol) ?error Must use initialized data.
|
||
#define symbol_set_define(set) void *const (set)[1];
|
||
#define symbol_set_declare(set) extern void *const (set)[1];
|
||
|
||
#define symbol_set_first_element(set) &(set)[1]
|
||
#define symbol_set_end_p(set, ptr) (*(ptr) == 0)
|
||
|
||
#endif /* ELF. */
|
||
#endif /* Have GNU ld. */
|
||
|
||
#endif /* libc-symbols.h */
|