* libnosys/acconfig.h (HAVE_SECTION_ATTRIBUTES): New macro.

* libnosys/configure.in: Check gcc's support for section attributes.
	* libnosys/warning.h: Have link_warning expand to nothing if gcc
	does not support section attributes.
This commit is contained in:
Thomas Fitzsimmons 2002-05-11 20:48:04 +00:00
parent 7124f04eb8
commit 558ab81ed1
6 changed files with 76 additions and 28 deletions

View File

@ -1,3 +1,10 @@
2002-05-11 Thomas Fitzsimmons <fitzsim@redhat.com>
* libnosys/acconfig.h (HAVE_SECTION_ATTRIBUTES): New macro.
* libnosys/configure.in: Check gcc's support for section attributes.
* libnosys/warning.h: Have link_warning expand to nothing if gcc
does not support section attributes.
2002-04-22 Jonathan Larmour <jlarmour@redhat.com> 2002-04-22 Jonathan Larmour <jlarmour@redhat.com>
* arm/syscall.h: New file. To define extra syscall values for RedBoot. * arm/syscall.h: New file. To define extra syscall values for RedBoot.

View File

@ -19,5 +19,8 @@
/* .pushsection/.popsection directives allowed */ /* .pushsection/.popsection directives allowed */
#undef HAVE_ASM_POPSECTION_DIRECTIVE #undef HAVE_ASM_POPSECTION_DIRECTIVE
/* support for section attributes */
#undef HAVE_SECTION_ATTRIBUTES
/* symbol prefix */ /* symbol prefix */
#undef __SYMBOL_PREFIX #undef __SYMBOL_PREFIX

View File

@ -15,5 +15,8 @@
/* .pushsection/.popsection directives allowed */ /* .pushsection/.popsection directives allowed */
#undef HAVE_ASM_POPSECTION_DIRECTIVE #undef HAVE_ASM_POPSECTION_DIRECTIVE
/* support for section attributes */
#undef HAVE_SECTION_ATTRIBUTES
/* symbol prefix */ /* symbol prefix */
#undef __SYMBOL_PREFIX #undef __SYMBOL_PREFIX

View File

@ -831,13 +831,14 @@ EOF
#define HAVE_ASM_PREVIOUS_DIRECTIVE 1 #define HAVE_ASM_PREVIOUS_DIRECTIVE 1
EOF EOF
else fi
rm -f conftest* rm -f conftest*
fi fi
echo "$ac_t""$libc_cv_asm_previous_directive" 1>&6 echo "$ac_t""$libc_cv_asm_previous_directive" 1>&6
echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6 echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
echo "configure:841: checking for .popsection assembler directive" >&5 echo "configure:842: checking for .popsection assembler directive" >&5
if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -845,29 +846,48 @@ else
.pushsection foo_section .pushsection foo_section
.popsection .popsection
EOF EOF
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:849: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:850: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define HAVE_ASM_POPSECTION_DIRECTIVE 1 #define HAVE_ASM_POPSECTION_DIRECTIVE 1
EOF EOF
fi fi
fi
rm -f conftest* rm -f conftest*
fi fi
echo "$ac_t""$libc_cv_asm_popsection_directive" 1>&6 echo "$ac_t""$libc_cv_asm_popsection_directive" 1>&6
echo $ac_n "checking for section attributes""... $ac_c" 1>&6
echo "configure:862: checking for section attributes" >&5
if eval "test \"`echo '$''{'libc_cv_section_attributes'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
int secttest __attribute__ ((section (".gnu.warning.secttest"))) = 10;
int main() {}
EOF
if { ac_try='${CC-cc} -c $CFLAGS conftest.c 1>&5'; { (eval echo configure:870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
cat >> confdefs.h <<\EOF
#define HAVE_SECTION_ATTRIBUTES 1
EOF
fi
rm -f conftest*
fi
echo "$ac_t""$libc_cv_section_attributes" 1>&6
;; ;;
esac esac
echo $ac_n "checking for function prefix""... $ac_c" 1>&6 echo $ac_n "checking for function prefix""... $ac_c" 1>&6
echo "configure:864: checking for function prefix" >&5 echo "configure:884: checking for function prefix" >&5
if eval "test \"`echo '$''{'libc_dollar_prefix'+set}'`\" = set"; then if eval "test \"`echo '$''{'libc_dollar_prefix'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.c <<\EOF cat > conftest.c <<\EOF
foo () { } foo () { }
EOF EOF
if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null'; { (eval echo configure:871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null'; { (eval echo configure:891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
then then
libc_dollar_prefix=yes libc_dollar_prefix=yes
else else
@ -892,7 +912,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args. # Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2 set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:896: checking for $ac_word" >&5 echo "configure:916: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -922,7 +942,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args. # Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2 set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:926: checking for $ac_word" >&5 echo "configure:946: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -971,7 +991,7 @@ fi
fi fi
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:975: checking whether we are using GNU C" >&5 echo "configure:995: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -980,7 +1000,7 @@ else
yes; yes;
#endif #endif
EOF EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1004: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes ac_cv_prog_gcc=yes
else else
ac_cv_prog_gcc=no ac_cv_prog_gcc=no
@ -995,7 +1015,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS" ac_save_CFLAGS="$CFLAGS"
CFLAGS= CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:999: checking whether ${CC-cc} accepts -g" >&5 echo "configure:1019: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1031,7 +1051,7 @@ LD=${LD-ld}
# Extract the first word of "ranlib", so it can be a program name with args. # Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2 set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1035: checking for $ac_word" >&5 echo "configure:1055: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1232,7 +1252,7 @@ cat >> $CONFIG_STATUS <<\EOF
# Split the substitutions into bite-sized pieces for seds with # Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX. # small command number limits, like on Digital OSF/1 and HP-UX.
ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script.
ac_file=1 # Number of current file. ac_file=1 # Number of current file.
ac_beg=1 # First line for current file. ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file.

View File

@ -143,8 +143,9 @@ case "${target}" in
EOF EOF
if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE) AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
else fi
rm -f conftest*]) rm -f conftest*])
AC_CACHE_CHECK(for .popsection assembler directive, AC_CACHE_CHECK(for .popsection assembler directive,
libc_cv_asm_popsection_directive, [dnl libc_cv_asm_popsection_directive, [dnl
cat > conftest.s <<EOF cat > conftest.s <<EOF
@ -154,6 +155,16 @@ EOF
if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE) AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
fi fi
rm -f conftest*])
AC_CACHE_CHECK(for section attributes,
libc_cv_section_attributes, [dnl
cat > conftest.c <<EOF
int secttest __attribute__ ((section (".gnu.warning.secttest"))) = 10;
int main() {}
EOF
if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.c 1>&AC_FD_CC); then
AC_DEFINE(HAVE_SECTION_ATTRIBUTES)
fi fi
rm -f conftest*]) rm -f conftest*])
;; ;;

View File

@ -15,10 +15,14 @@
# define __make_section_unallocated(section_string) # define __make_section_unallocated(section_string)
# endif # endif
# ifdef HAVE_SECTION_ATTRIBUTES
# define link_warning(symbol, msg) \ # define link_warning(symbol, msg) \
__make_section_unallocated (".gnu.warning." #symbol) \ __make_section_unallocated (".gnu.warning." #symbol) \
static const char __evoke_link_warning_##symbol[] \ static const char __evoke_link_warning_##symbol[] \
__attribute__ ((section (".gnu.warning." #symbol))) = msg; __attribute__ ((section (".gnu.warning." #symbol))) = msg;
# else
# define link_warning(symbol, msg)
# endif
#else /* !ELF */ #else /* !ELF */