From: Kai Tietz Date: Tue, 27 Apr 2010 17:26:09 +0000 (+0000) Subject: 2010-04-27 Kai Tietz X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ef72a554d982f439fb9be357386681c1d4fb475c;p=binutils-gdb.git 2010-04-27 Kai Tietz * pe-x86_64.c (TARGET_UNDERSCORE): Set value dependent to USE_MINGW64_LEADING_UNDERSCORES. * pei-x86_64.c (TARGET_UNDERSCORE): Likewise. * config.bfd: Change underscoring default for x64 mingw to false. * coffcode.h (coff_write_relocs): Add check that dereferenced sym_ptr_ptr isn't NULL. * config.in (USE_MINGW64_LEADING_UNDERSCORES): New. * configure: Regenerated. * configure.in: Add option '--enable-leading-mingw64-underscores' and define config.in variable USE_MINGW64_LEADING_UNDERSCORES. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 411e043c83e..bf051a4f60e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2010-04-27 Kai Tietz + + * pe-x86_64.c (TARGET_UNDERSCORE): Set value dependent + to USE_MINGW64_LEADING_UNDERSCORES. + * pei-x86_64.c (TARGET_UNDERSCORE): Likewise. + * config.bfd: Change underscoring default for x64 mingw + to false. + * coffcode.h (coff_write_relocs): Add check that dereferenced + sym_ptr_ptr isn't NULL. + * config.in (USE_MINGW64_LEADING_UNDERSCORES): New. + * configure: Regenerated. + * configure.in: Add option '--enable-leading-mingw64-underscores' + and define config.in variable USE_MINGW64_LEADING_UNDERSCORES. + 2010-04-27 Nick Clifton PR binutils/11512 diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 159df27f948..364daaad5c1 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -2648,7 +2648,7 @@ coff_write_relocs (bfd * abfd, int first_undef) entries know which symbol index they point to. So we have to look up the output symbol here. */ - if (q->sym_ptr_ptr[0]->the_bfd != abfd) + if (q->sym_ptr_ptr[0] != NULL && q->sym_ptr_ptr[0]->the_bfd != abfd) { int j; const char *sname = q->sym_ptr_ptr[0]->name; @@ -2677,7 +2677,7 @@ coff_write_relocs (bfd * abfd, int first_undef) n.r_symndx = q->addend; else #endif - if (q->sym_ptr_ptr) + if (q->sym_ptr_ptr && q->sym_ptr_ptr[0] != NULL) { #ifdef SECTION_RELATIVE_ABSOLUTE_SYMBOL_P if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q, s)) diff --git a/bfd/config.bfd b/bfd/config.bfd index ffae42831a2..6420f5fb2df 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -177,7 +177,6 @@ case "${targ}" in ;; alpha*-*-*vms*) targ_defvec=vms_alpha_vec - targ_selvecs=vms_lib_txt_vec want64=true ;; alpha*-*-*) @@ -640,7 +639,7 @@ case "${targ}" in targ_defvec=x86_64pe_vec targ_selvecs="x86_64pe_vec x86_64pei_vec bfd_elf64_x86_64_vec bfd_elf64_l1om_vec" want64=true - targ_underscore=yes + targ_underscore=no ;; #endif i[3-7]86-*-lynxos*) @@ -1511,6 +1510,10 @@ case "${targ}" in targ_defvec=bfd_elf32_vax_vec ;; + vax*-*-*vms*) + targ_defvec=vms_vax_vec + ;; + we32k-*-*) targ_defvec=we32kcoff_vec ;; diff --git a/bfd/config.in b/bfd/config.in index 065c905816c..b0b97a27f49 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -297,6 +297,9 @@ /* Use b modifier when opening binary files? */ #undef USE_BINARY_FOPEN +/* Define if we should use leading underscore on 64 bit mingw targets */ +#undef USE_MINGW64_LEADING_UNDERSCORES + /* Use mmap if it's available? */ #undef USE_MMAP diff --git a/bfd/configure b/bfd/configure index 7d16fab0be6..6ace16c35e8 100755 --- a/bfd/configure +++ b/bfd/configure @@ -785,6 +785,7 @@ enable_64_bit_bfd enable_targets with_mmap enable_secureplt +enable_leading_mingw64_underscores with_separate_debug_dir enable_elf_stt_common with_pkgversion @@ -1435,6 +1436,8 @@ Optional Features: --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) --enable-targets alternative target configurations --enable-secureplt Default to creating read-only plt entries + --enable-leading-mingw64-underscores + Enable leading underscores on 64 bit mingw targets --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 @@ -11402,7 +11405,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11405 "configure" +#line 11408 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11508,7 +11511,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11511 "configure" +#line 11514 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12049,6 +12052,17 @@ $as_echo "#define USE_SECUREPLT 1" >>confdefs.h fi +# Check whether --enable-leading-mingw64-underscores was given. +if test "${enable_leading_mingw64_underscores+set}" = set; then : + enableval=$enable_leading_mingw64_underscores; +fi + +if test x"$enable_leading_mingw64_underscores" = xyes ; then : + +$as_echo "#define USE_MINGW64_LEADING_UNDERSCORES 1" >>confdefs.h + +fi + DEBUGDIR=${libdir}/debug # Check whether --with-separate-debug-dir was given. diff --git a/bfd/configure.in b/bfd/configure.in index eb9d7e76340..6f055056e0b 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -75,6 +75,14 @@ if test $use_secureplt = true; then [Define if we should default to creating read-only plt entries]) fi +AC_ARG_ENABLE(leading-mingw64-underscores, + AS_HELP_STRING([--enable-leading-mingw64-underscores], + [Enable leading underscores on 64 bit mingw targets]), + [],[]) +AS_IF([ test x"$enable_leading_mingw64_underscores" = xyes ], + [AC_DEFINE(USE_MINGW64_LEADING_UNDERSCORES, 1, + [Define if we should use leading underscore on 64 bit mingw targets])]) + DEBUGDIR=${libdir}/debug AC_ARG_WITH(separate-debug-dir, AS_HELP_STRING([--with-separate-debug-dir=DIR], diff --git a/bfd/pe-x86_64.c b/bfd/pe-x86_64.c index bcf18b6e8ab..76fc7c70283 100644 --- a/bfd/pe-x86_64.c +++ b/bfd/pe-x86_64.c @@ -28,7 +28,11 @@ #define COFF_WITH_PE #define COFF_WITH_pex64 #define PCRELOFFSET TRUE +#if defined (USE_MINGW64_LEADING_UNDERSCORES) #define TARGET_UNDERSCORE '_' +#else +#define TARGET_UNDERSCORE 0 +#endif #define COFF_LONG_SECTION_NAMES #define COFF_SUPPORT_GNU_LINKONCE #define COFF_LONG_FILENAMES diff --git a/bfd/pei-x86_64.c b/bfd/pei-x86_64.c index f5b8abdc8a3..fa9a2677359 100644 --- a/bfd/pei-x86_64.c +++ b/bfd/pei-x86_64.c @@ -29,7 +29,11 @@ #define COFF_WITH_PE #define COFF_WITH_pex64 #define PCRELOFFSET TRUE +#if defined (USE_MINGW64_LEADING_UNDERSCORES) #define TARGET_UNDERSCORE '_' +#else +#define TARGET_UNDERSCORE 0 +#endif /* Long section names not allowed in executable images, only object files. */ #define COFF_LONG_SECTION_NAMES 0 #define COFF_SUPPORT_GNU_LINKONCE