diff options
author | Nick Clifton <nickc@redhat.com> | 2007-10-16 14:42:15 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2007-10-16 14:42:15 +0000 |
commit | 504b7d2026f1fbbe912b6f513c069c0d47ba2505 (patch) | |
tree | aa3186b5ab4a002cd64900af269e99d41031d584 /bfd | |
parent | 62c018fe4a6de89d710e84b7efffe2462fa435cd (diff) | |
download | gdb-504b7d2026f1fbbe912b6f513c069c0d47ba2505.zip gdb-504b7d2026f1fbbe912b6f513c069c0d47ba2505.tar.gz gdb-504b7d2026f1fbbe912b6f513c069c0d47ba2505.tar.bz2 |
Support the use of the STT_COMMON type. (In source and object files only at the moment)
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 12 | ||||
-rw-r--r-- | bfd/config.in | 3 | ||||
-rwxr-xr-x | bfd/configure | 68 | ||||
-rw-r--r-- | bfd/configure.in | 24 | ||||
-rw-r--r-- | bfd/elf.c | 6 | ||||
-rw-r--r-- | bfd/elfcode.h | 4 |
6 files changed, 98 insertions, 19 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a93c102..09d3a7e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +2007-10-16 Nick Clifton <nickc@redhat.com> + + * configure.in (--enable-elf-stt-common): New configure + option. If enabled then the tools can generate symbols with + the ELF STT_COMMON type. + * config.in: Regenerate. + * configure: Regenerate. + * elf.c (swap_out_syms): If USE_STT_COMMON is defined then set + the type of emitted common symbols to STT_COMMON. + * elfcode.h (elf_slurp_symbol_table): Accept STT_COMMON symbol + types. + 2007-10-15 Alan Modra <amodra@bigpond.net.au> * coff-arm.c (arm_emit_base_file_entry): Check fwrite return value. diff --git a/bfd/config.in b/bfd/config.in index aa91dd6..fd14f82 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -285,6 +285,9 @@ /* Define if we should default to creating read-only plt entries */ #undef USE_SECUREPLT +/* Define if we may generate symbols with ELF's STT_COMMON type */ +#undef USE_STT_COMMON + /* Version number of package */ #undef VERSION diff --git a/bfd/configure b/bfd/configure index 019bddd9..806ee7e 100755 --- a/bfd/configure +++ b/bfd/configure @@ -1012,6 +1012,7 @@ Optional Features: --enable-targets alternative target configurations --enable-commonbfdlib build shared BFD/opcodes/libiberty library --enable-secureplt Default to creating read-only plt entries + --enable-elf-stt-common Allow the generation of ELF symbols with the STT_COMMON type --enable-werror treat compile warnings as errors --enable-build-warnings enable build-time compiler warnings --enable-maintainer-mode enable make rules and dependencies not useful @@ -4665,13 +4666,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4668: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4669: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4671: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4672: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4674: output\"" >&5) + (eval echo "\"\$as_me:4675: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5726,7 +5727,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5729 "configure"' > conftest.$ac_ext + echo '#line 5730 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6826,11 +6827,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6829: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6830: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6833: \$? = $ac_status" >&5 + echo "$as_me:6834: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7148,11 +7149,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7151: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7152: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7155: \$? = $ac_status" >&5 + echo "$as_me:7156: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7253,11 +7254,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7256: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7257: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7260: \$? = $ac_status" >&5 + echo "$as_me:7261: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7308,11 +7309,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7311: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7312: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7315: \$? = $ac_status" >&5 + echo "$as_me:7316: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10105,7 +10106,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10108 "configure" +#line 10109 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10205,7 +10206,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10208 "configure" +#line 10209 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10449,7 +10450,8 @@ echo "$as_me: error: bad value ${enableval} for 64-bit-bfd option" >&2;} esac else want64=false -fi; # Check whether --enable-targets or --disable-targets was given. +fi; +# Check whether --enable-targets or --disable-targets was given. if test "${enable_targets+set}" = set; then enableval="$enable_targets" case "${enableval}" in @@ -10460,7 +10462,8 @@ echo "$as_me: error: enable-targets option must specify target names or 'all'" > no) enable_targets= ;; *) enable_targets=$enableval ;; esac -fi; # Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. +fi; +# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. if test "${enable_commonbfdlib+set}" = set; then enableval="$enable_commonbfdlib" case "${enableval}" in @@ -10471,6 +10474,7 @@ echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;} { (exit 1); exit 1; }; } ;; esac fi; + # Check whether --with-mmap or --without-mmap was given. if test "${with_mmap+set}" = set; then withval="$with_mmap" @@ -10506,7 +10510,6 @@ fi DEBUGDIR=${libdir}/debug - # Check whether --with-separate-debug-dir or --without-separate-debug-dir was given. if test "${with_separate_debug_dir+set}" = set; then withval="$with_separate_debug_dir" @@ -10514,6 +10517,37 @@ if test "${with_separate_debug_dir+set}" = set; then fi; +# Check to see if we should allow the generation of +# symbols with the ELF standard's STT_COMMON type. +# Check whether --enable-elf-stt-common or --disable-elf-stt-common was given. +if test "${enable_elf_stt_common+set}" = set; then + enableval="$enable_elf_stt_common" + case "${enableval}" in + yes) want_elf_stt_common=true ;; + no) want_elf_stt_common=false ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for ELF STT_COMMON option" >&5 +echo "$as_me: error: bad value ${enableval} for ELF STT_COMMON option" >&2;} + { (exit 1); exit 1; }; } ;; + esac +else + # We have to choose a default behaviour. For native builds we could +# test whether the loader supports the STT_COMMON type. For cross +# toolchains we default to assuming that they are not supported. +if test "$cross_compiling" != yes; then + want_elf_stt_common=false + else + # XXX FIXME: Add code to test the loader here. + want_elf_stt_common=false + fi +fi; if test $want_elf_stt_common = true; then + +cat >>confdefs.h <<\_ACEOF +#define USE_STT_COMMON 1 +_ACEOF + +fi + + # Check whether --with-pkgversion or --without-pkgversion was given. diff --git a/bfd/configure.in b/bfd/configure.in index facc1a3..ad8440e 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -31,6 +31,7 @@ AC_ARG_ENABLE(64-bit-bfd, no) want64=false ;; *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; esac],[want64=false])dnl + AC_ARG_ENABLE(targets, [ --enable-targets alternative target configurations], [case "${enableval}" in @@ -39,6 +40,7 @@ AC_ARG_ENABLE(targets, no) enable_targets= ;; *) enable_targets=$enableval ;; esac])dnl + AC_ARG_ENABLE(commonbfdlib, [ --enable-commonbfdlib build shared BFD/opcodes/libiberty library], [case "${enableval}" in @@ -46,6 +48,7 @@ AC_ARG_ENABLE(commonbfdlib, no) commonbfdlib=false ;; *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; esac])dnl + AC_ARG_WITH(mmap, [ --with-mmap try using mmap for BFD input files if available], [case "${withval}" in @@ -67,13 +70,32 @@ if test $use_secureplt = true; then fi DEBUGDIR=${libdir}/debug - AC_ARG_WITH(separate-debug-dir, AS_HELP_STRING([--with-separate-debug-dir=DIR], [Look for global separate debug info in DIR [[default=LIBDIR/debug]]]), [DEBUGDIR="${withval}"]) AC_SUBST(DEBUGDIR) +# Check to see if we should allow the generation of +# symbols with the ELF standard's STT_COMMON type. +AC_ARG_ENABLE(elf-stt-common, +[ --enable-elf-stt-common Allow the generation of ELF symbols with the STT_COMMON type], +[case "${enableval}" in + yes) want_elf_stt_common=true ;; + no) want_elf_stt_common=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for ELF STT_COMMON option) ;; + esac], +# We have to choose a default behaviour. For native builds we could +# test whether the loader supports the STT_COMMON type, but that would +# mean that built binaries could not be exported to older systems where +# the loader does not support it. So by default we always choose to +# disable this feature. + want_elf_stt_common=false)dnl +if test $want_elf_stt_common = true; then + AC_DEFINE(USE_STT_COMMON, 1, + [Define if we may generate symbols with ELF's STT_COMMON type]) +fi + ACX_PKGVERSION([GNU Binutils]) ACX_BUGURL([http://www.sourceware.org/bugzilla/]) @@ -6297,7 +6297,11 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"), sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); } else if (bfd_is_com_section (syms[idx]->section)) - sym.st_info = ELF_ST_INFO (STB_GLOBAL, type); + sym.st_info = ELF_ST_INFO (STB_GLOBAL, +#ifdef USE_STT_COMMON + type == STT_OBJECT ? STT_COMMON : +#endif + type); else if (bfd_is_und_section (syms[idx]->section)) sym.st_info = ELF_ST_INFO (((flags & BSF_WEAK) ? STB_WEAK diff --git a/bfd/elfcode.h b/bfd/elfcode.h index e1f5801..ea2a6d3 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1323,6 +1323,10 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic) case STT_FUNC: sym->symbol.flags |= BSF_FUNCTION; break; + case STT_COMMON: + /* FIXME: Do we have to put the size field into the value field + as we do with symbols in SHN_COMMON sections (see above) ? */ + /* Fall through. */ case STT_OBJECT: sym->symbol.flags |= BSF_OBJECT; break; |