From 9db4e192616e44ae419ad16c1c6a9c3b20eafaa7 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 6 May 2004 02:46:29 +0000 Subject: [PATCH] * configure.in (bfd_elf32_frvfdpic_vec): New. * configure: Rebuilt. * targets.c (bfd_elf32_frvfdpic_vec): New. * config.bfd: Enable it on frv-*-elf and frv-*-*linux*, as default on the latter. * elf32-frv.c: Prefix all identifiers added for FDPIC support with frvfdpic instead of frv. Rearrange elf-target macros such that the FDPIC-specific ones are only defined for this new target vector. (bfd_elf32_frvfdpic_vec): Declare. (IS_FDPIC): New. (elf32_frv_relocate_section): Use it to enable segment checking and to control rofixup emission. Add output section vma to applied relocation in non-LOAD non-ALLOC sections. Use _bfd_error_handler for errors. (_frv_create_got_section): Create .rel.got and .rofixup only in FDPIC. Create non-dynamic _gp at .got+2048 in non-FDPIC, like the linker script. (elf32_frvfdpic_size_dynamic_sections): Assume FDPIC. (elf32_frvfdpic_modify_segment_map): Likewise. (elf32_frv_finish_dynamic_sections): New, do-nothing. (elf32_frvfdpic_finish_dynamic_sections): Assume FDPIC. Improve error message if we miscompute the rofixup size. (frvfdpic_elf_use_relative_eh_frame): Assume FDPIC. (frvfdpic_elf_encode_eh_address): Likewise. (elf32_frv_check_relocs): Reject FDPIC-only relocs in non-FDPIC. Record relocs only in FDPIC. Make sure _gp is defined for GPREL relocs. Reject unknown relocation types. (elf32_frv_object_p): Make sure target vector matches FDPIC bits. (frv_elf_merge_private_bfd_data): Likewise. (ELF_MAXPAGESIZE): Revert to 0x1000 for elf32-frv; keep it as 0x4000 for newly-added elf32-frvfdpic. --- bfd/ChangeLog | 35 ++ bfd/config.bfd | 7 +- bfd/configure | 579 +++++++++++++----------- bfd/configure.in | 1 + bfd/elf32-frv.c | 1288 ++++++++++++++++++++++++++++++------------------------ bfd/targets.c | 2 + 6 files changed, 1085 insertions(+), 827 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d8b366621..bd835c502 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,38 @@ +2004-05-05 Alexandre Oliva + + * configure.in (bfd_elf32_frvfdpic_vec): New. + * configure: Rebuilt. + * targets.c (bfd_elf32_frvfdpic_vec): New. + * config.bfd: Enable it on frv-*-elf and frv-*-*linux*, as default + on the latter. + * elf32-frv.c: Prefix all identifiers added for FDPIC support with + frvfdpic instead of frv. Rearrange elf-target macros such that + the FDPIC-specific ones are only defined for this new target + vector. + (bfd_elf32_frvfdpic_vec): Declare. + (IS_FDPIC): New. + (elf32_frv_relocate_section): Use it to enable segment checking + and to control rofixup emission. Add output section vma to + applied relocation in non-LOAD non-ALLOC sections. Use + _bfd_error_handler for errors. + (_frv_create_got_section): Create .rel.got and .rofixup only in + FDPIC. Create non-dynamic _gp at .got+2048 in non-FDPIC, like the + linker script. + (elf32_frvfdpic_size_dynamic_sections): Assume FDPIC. + (elf32_frvfdpic_modify_segment_map): Likewise. + (elf32_frv_finish_dynamic_sections): New, do-nothing. + (elf32_frvfdpic_finish_dynamic_sections): Assume FDPIC. Improve + error message if we miscompute the rofixup size. + (frvfdpic_elf_use_relative_eh_frame): Assume FDPIC. + (frvfdpic_elf_encode_eh_address): Likewise. + (elf32_frv_check_relocs): Reject FDPIC-only relocs in non-FDPIC. + Record relocs only in FDPIC. Make sure _gp is defined for GPREL + relocs. Reject unknown relocation types. + (elf32_frv_object_p): Make sure target vector matches FDPIC bits. + (frv_elf_merge_private_bfd_data): Likewise. + (ELF_MAXPAGESIZE): Revert to 0x1000 for elf32-frv; keep it as + 0x4000 for newly-added elf32-frvfdpic. + 2004-05-05 Nick Clifton PR/136 diff --git a/bfd/config.bfd b/bfd/config.bfd index a158ca608..41f1268fe 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -339,10 +339,15 @@ case "${targ}" in targ_defvec=bfd_elf32_fr30_vec ;; - frv-*-elf | frv-*-*linux*) + frv-*-elf) targ_defvec=bfd_elf32_frv_vec + targ_selvecs=bfd_elf32_frvfdpic_vec ;; + frv-*-*linux*) + targ_defvec=bfd_elf32_frvfdpic_vec + targ_selvecs=bfd_elf32_frv_vec + ;; h8300*-*-elf) targ_defvec=bfd_elf32_h8300_vec diff --git a/bfd/configure b/bfd/configure index 8bbd2b7e6..112d34922 100755 --- a/bfd/configure +++ b/bfd/configure @@ -1619,6 +1619,7 @@ cygwin* | mingw* |pw32*) ;; darwin* | rhapsody*) + # this will be overwritten by pass_all, but leave it in just in case lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in @@ -1629,9 +1630,10 @@ darwin* | rhapsody*) lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' ;; esac + lt_cv_deplibs_check_method=pass_all ;; -freebsd* ) +freebsd* | kfreebsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -1699,7 +1701,7 @@ linux-gnu*) lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` ;; -netbsd*) +netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' else @@ -1753,13 +1755,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1757: checking for object suffix" >&5 +echo "configure:1759: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1765: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1779,7 +1781,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1783: checking for executable suffix" >&5 +echo "configure:1785: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1789,7 +1791,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -1816,7 +1818,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1820: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1822: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1878,7 +1880,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1882: checking for file" >&5 +echo "configure:1884: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1949,7 +1951,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1953: checking for $ac_word" >&5 +echo "configure:1955: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1981,7 +1983,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1985: checking for $ac_word" >&5 +echo "configure:1987: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2016,7 +2018,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2020: checking for $ac_word" >&5 +echo "configure:2022: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2048,7 +2050,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2052: checking for $ac_word" >&5 +echo "configure:2054: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2115,8 +2117,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2119 "configure"' > conftest.$ac_ext - if { (eval echo configure:2120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2121 "configure"' > conftest.$ac_ext + if { (eval echo configure:2122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) @@ -2149,7 +2151,7 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:2155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -2162,12 +2164,54 @@ ia64-*-hpux*) rm -rf conftest* ;; +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo configure:2171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2171: checking whether the C compiler needs -belf" >&5 +echo "configure:2215: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2180,14 +2224,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2377,7 +2421,7 @@ if test -z "$target" ; then fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2381: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2425: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -2400,7 +2444,7 @@ fi echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6 -echo "configure:2404: checking whether to install libbfd" >&5 +echo "configure:2448: checking whether to install libbfd" >&5 # Check whether --enable-install-libbfd or --disable-install-libbfd was given. if test "${enable_install_libbfd+set}" = set; then enableval="$enable_install_libbfd" @@ -2437,7 +2481,7 @@ fi echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2441: checking for executable suffix" >&5 +echo "configure:2485: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2447,7 +2491,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -2477,7 +2521,7 @@ bfd_default_target_size=32 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2481: checking for $ac_word" >&5 +echo "configure:2525: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2507,7 +2551,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2511: checking for $ac_word" >&5 +echo "configure:2555: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2558,7 +2602,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2562: checking for $ac_word" >&5 +echo "configure:2606: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2590,7 +2634,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2594: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2638: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2601,12 +2645,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2605 "configure" +#line 2649 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2632,12 +2676,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2636: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2680: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2641: checking whether we are using GNU C" >&5 +echo "configure:2685: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2646,7 +2690,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2650: \"$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:2694: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2665,7 +2709,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2669: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2713: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2699,7 +2743,7 @@ fi ALL_LINGUAS="fr tr ja es sv da zh_CN ro" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2703: checking how to run the C preprocessor" >&5 +echo "configure:2747: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2714,13 +2758,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2768: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2731,13 +2775,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2741: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2748,13 +2792,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2781,7 +2825,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2785: checking for $ac_word" >&5 +echo "configure:2829: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2809,12 +2853,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2813: checking for ANSI C header files" >&5 +echo "configure:2857: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2822,7 +2866,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2826: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2839,7 +2883,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2857,7 +2901,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2878,7 +2922,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2889,7 +2933,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2913,12 +2957,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2917: checking for working const" >&5 +echo "configure:2961: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3015: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2988,21 +3032,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2992: checking for inline" >&5 +echo "configure:3036: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -3028,12 +3072,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:3032: checking for off_t" >&5 +echo "configure:3076: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3061,12 +3105,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3065: checking for size_t" >&5 +echo "configure:3109: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3096,19 +3140,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3100: checking for working alloca.h" >&5 +echo "configure:3144: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3129,12 +3173,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3133: checking for alloca" >&5 +echo "configure:3177: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3194,12 +3238,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3198: checking whether alloca needs Cray hooks" >&5 +echo "configure:3242: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3228: checking for $ac_func" >&5 +echo "configure:3272: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3279,7 +3323,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3283: checking stack direction for C alloca" >&5 +echo "configure:3327: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3287,7 +3331,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3327,21 +3371,21 @@ EOF fi -for ac_hdr in unistd.h +for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3335: checking for $ac_hdr" >&5 +echo "configure:3379: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3370,12 +3414,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3374: checking for $ac_func" >&5 +echo "configure:3418: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3423,7 +3467,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3427: checking for working mmap" >&5 +echo "configure:3471: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3431,7 +3475,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext < #include +#if HAVE_SYS_TYPES_H +# include +#endif + +#if HAVE_STDLIB_H +# include +#endif + +#if HAVE_SYS_STAT_H +# include +#endif + +#if HAVE_UNISTD_H +# include +#endif + /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -3571,7 +3628,7 @@ main() } EOF -if { (eval echo configure:3575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3599,17 +3656,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3603: checking for $ac_hdr" >&5 +echo "configure:3660: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3670: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3639,12 +3696,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3643: checking for $ac_func" >&5 +echo "configure:3700: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3696,12 +3753,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3700: checking for $ac_func" >&5 +echo "configure:3757: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3758,19 +3815,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3762: checking for LC_MESSAGES" >&5 +echo "configure:3819: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3791,7 +3848,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3795: checking whether NLS is requested" >&5 +echo "configure:3852: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3811,7 +3868,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3815: checking whether included gettext is requested" >&5 +echo "configure:3872: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3830,17 +3887,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3834: checking for libintl.h" >&5 +echo "configure:3891: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3844: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3901: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3857,19 +3914,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3861: checking for gettext in libc" >&5 +echo "configure:3918: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3885,7 +3942,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3889: checking for bindtextdomain in -lintl" >&5 +echo "configure:3946: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3893,7 +3950,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3920,19 +3977,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3924: checking for gettext in libintl" >&5 +echo "configure:3981: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3993: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -3960,7 +4017,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3964: checking for $ac_word" >&5 +echo "configure:4021: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3994,12 +4051,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3998: checking for $ac_func" >&5 +echo "configure:4055: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4049,7 +4106,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4053: checking for $ac_word" >&5 +echo "configure:4110: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4085,7 +4142,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4089: checking for $ac_word" >&5 +echo "configure:4146: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4117,7 +4174,7 @@ else fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4157,7 +4214,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4161: checking for $ac_word" >&5 +echo "configure:4218: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4191,7 +4248,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4195: checking for $ac_word" >&5 +echo "configure:4252: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4227,7 +4284,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4231: checking for $ac_word" >&5 +echo "configure:4288: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4317,7 +4374,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4321: checking for catalogs to be installed" >&5 +echo "configure:4378: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4345,17 +4402,17 @@ echo "configure:4321: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4349: checking for linux/version.h" >&5 +echo "configure:4406: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4359: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4433,7 +4490,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:4437: checking for a BSD compatible install" >&5 +echo "configure:4494: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4493,19 +4550,19 @@ BFD_HOST_64_BIT= BFD_HOST_U_64_BIT= echo $ac_n "checking for long long""... $ac_c" 1>&6 -echo "configure:4497: checking for long long" >&5 +echo "configure:4554: checking for long long" >&5 if eval "test \"`echo '$''{'bfd_cv_has_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_has_long_long=yes else @@ -4521,13 +4578,13 @@ echo "$ac_t""$bfd_cv_has_long_long" 1>&6 if test $bfd_cv_has_long_long = yes; then BFD_HOST_LONG_LONG=1 echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:4525: checking size of long long" >&5 +echo "configure:4582: checking size of long long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext < @@ -4537,7 +4594,7 @@ int main() { switch (0) case 0: case (sizeof (long long) == $ac_size):; ; return 0; } EOF -if { (eval echo configure:4541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4598: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sizeof_long_long=$ac_size else @@ -4562,13 +4619,13 @@ EOF fi echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:4566: checking size of long" >&5 +echo "configure:4623: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext < @@ -4578,7 +4635,7 @@ int main() { switch (0) case 0: case (sizeof (long) == $ac_size):; ; return 0; } EOF -if { (eval echo configure:4582: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4639: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sizeof_long=$ac_size else @@ -4636,7 +4693,7 @@ if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' else echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4640: checking for build system executable suffix" >&5 +echo "configure:4697: checking for build system executable suffix" >&5 if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4664,17 +4721,17 @@ for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4668: checking for $ac_hdr" >&5 +echo "configure:4725: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4678: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4735: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4704,17 +4761,17 @@ for ac_hdr in fcntl.h sys/file.h sys/time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4708: checking for $ac_hdr" >&5 +echo "configure:4765: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4718: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4741,12 +4798,12 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:4745: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:4802: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -4755,7 +4812,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:4759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -4780,12 +4837,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4784: checking for $ac_hdr that defines DIR" >&5 +echo "configure:4841: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -4793,7 +4850,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:4797: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4854: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -4818,7 +4875,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4822: checking for opendir in -ldir" >&5 +echo "configure:4879: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4826,7 +4883,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4859,7 +4916,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4863: checking for opendir in -lx" >&5 +echo "configure:4920: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4867,7 +4924,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4903,12 +4960,12 @@ fi for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4907: checking for $ac_func" >&5 +echo "configure:4964: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4958,12 +5015,12 @@ done for ac_func in strtoull do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4962: checking for $ac_func" >&5 +echo "configure:5019: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5047: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5021,12 +5078,12 @@ EOF esac echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:5025: checking whether strstr must be declared" >&5 +echo "configure:5082: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5047,7 +5104,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:5051: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -5068,12 +5125,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:5072: checking whether malloc must be declared" >&5 +echo "configure:5129: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5094,7 +5151,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:5098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -5115,12 +5172,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:5119: checking whether realloc must be declared" >&5 +echo "configure:5176: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5141,7 +5198,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:5145: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5202: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -5162,12 +5219,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:5166: checking whether free must be declared" >&5 +echo "configure:5223: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5188,7 +5245,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:5192: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -5209,12 +5266,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:5213: checking whether getenv must be declared" >&5 +echo "configure:5270: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5235,7 +5292,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:5239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5296: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no else @@ -5411,16 +5468,16 @@ if test "${target}" = "${host}"; then # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE # have c_impl as a member of struct core_dumpx echo $ac_n "checking for c_impl in struct core_dumpx""... $ac_c" 1>&6 -echo "configure:5415: checking for c_impl in struct core_dumpx" >&5 +echo "configure:5472: checking for c_impl in struct core_dumpx" >&5 cat > conftest.$ac_ext < int main() { struct core_dumpx c; c.c_impl = 0; ; return 0; } EOF -if { (eval echo configure:5424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_ST_C_IMPL 1 @@ -5497,17 +5554,17 @@ rm -f conftest* do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5501: checking for $ac_hdr" >&5 +echo "configure:5558: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5511: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5535,12 +5592,12 @@ done if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5539: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5596: checking for prstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5571,12 +5628,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6 echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5575: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5632: checking for prstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5607,12 +5664,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6 echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5611: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5668: checking for prstatus_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5682: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes else @@ -5643,12 +5700,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6 echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5647: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5704: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5718: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes else @@ -5679,12 +5736,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6 echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5683: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5740: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5754: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5715,12 +5772,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5719: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5776: checking for pxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5790: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5751,12 +5808,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6 echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5755: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5812: checking for pstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5826: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5787,12 +5844,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6 echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5791: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5848: checking for prpsinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5823,12 +5880,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6 echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5827: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5884: checking for prpsinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5898: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5859,12 +5916,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6 echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5863: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5920: checking for psinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5895,12 +5952,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6 echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5899: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5956: checking for psinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5931,12 +5988,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6 echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5935: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5992: checking for lwpstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5967,12 +6024,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5971: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:6028: checking for lwpxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6042: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -6003,12 +6060,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6007: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:6064: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6078: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes else @@ -6039,12 +6096,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6043: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:6100: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes else @@ -6075,12 +6132,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6 echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6079: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:6136: checking for win32_pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -6279,6 +6336,7 @@ do bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;; bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;; bfd_elf32_frv_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;; + bfd_elf32_frvfdpic_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;; bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;; bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; @@ -6560,10 +6618,10 @@ case ${host64}-${target64}-${want64} in if test -n "$GCC" ; then bad_64bit_gcc=no; echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6 -echo "configure:6564: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6622: checking for gcc version with buggy 64-bit support" >&5 # Add more tests for gcc versions with non-working 64-bit support here. cat > conftest.$ac_ext <&6 -echo "configure:6609: checking for $ac_func" >&5 +echo "configure:6667: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6659,13 +6717,13 @@ done if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then echo $ac_n "checking size of off_t""... $ac_c" 1>&6 -echo "configure:6663: checking size of off_t" >&5 +echo "configure:6721: checking size of off_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext < @@ -6675,7 +6733,7 @@ int main() { switch (0) case 0: case (sizeof (off_t) == $ac_size):; ; return 0; } EOF -if { (eval echo configure:6679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sizeof_off_t=$ac_size else @@ -6699,7 +6757,7 @@ EOF fi echo $ac_n "checking file_ptr type""... $ac_c" 1>&6 -echo "configure:6703: checking file_ptr type" >&5 +echo "configure:6761: checking file_ptr type" >&5 bfd_file_ptr="long" bfd_ufile_ptr="unsigned long" if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes \ @@ -6720,21 +6778,21 @@ test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selar test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}" -for ac_hdr in unistd.h +for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6728: checking for $ac_hdr" >&5 +echo "configure:6786: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6738: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6763,12 +6821,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6767: checking for $ac_func" >&5 +echo "configure:6825: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6816,7 +6874,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6820: checking for working mmap" >&5 +echo "configure:6878: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6824,7 +6882,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext < #include +#if HAVE_SYS_TYPES_H +# include +#endif + +#if HAVE_STDLIB_H +# include +#endif + +#if HAVE_SYS_STAT_H +# include +#endif + +#if HAVE_UNISTD_H +# include +#endif + /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -6964,7 +7035,7 @@ main() } EOF -if { (eval echo configure:6968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6989,12 +7060,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6993: checking for $ac_func" >&5 +echo "configure:7064: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.in b/bfd/configure.in index 7d9594cd5..eafe2aeb2 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -601,6 +601,7 @@ do bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;; bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;; bfd_elf32_frv_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;; + bfd_elf32_frvfdpic_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;; bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;; bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 6412acdfb..f00976f79 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -583,10 +583,12 @@ static const struct frv_reloc_map frv_reloc_map [] = }; #endif +extern const bfd_target bfd_elf32_frvfdpic_vec; +#define IS_FDPIC(bfd) ((bfd)->xvec == &bfd_elf32_frvfdpic_vec) /* An extension of the elf hash table data structure, containing some additional FRV-specific data. */ -struct frv_elf_link_hash_table +struct frvfdpic_elf_link_hash_table { struct elf_link_hash_table elf; @@ -612,33 +614,33 @@ struct frv_elf_link_hash_table /* Get the FRV ELF linker hash table from a link_info structure. */ -#define frv_hash_table(info) \ - ((struct frv_elf_link_hash_table *) ((info)->hash)) - -#define frv_got_section(info) \ - (frv_hash_table (info)->sgot) -#define frv_gotrel_section(info) \ - (frv_hash_table (info)->sgotrel) -#define frv_gotfixup_section(info) \ - (frv_hash_table (info)->sgotfixup) -#define frv_plt_section(info) \ - (frv_hash_table (info)->splt) -#define frv_pltrel_section(info) \ - (frv_hash_table (info)->spltrel) -#define frv_relocs_info(info) \ - (frv_hash_table (info)->relocs_info) -#define frv_got_initial_offset(info) \ - (frv_hash_table (info)->got0) -#define frv_plt_initial_offset(info) \ - (frv_hash_table (info)->plt0) +#define frvfdpic_hash_table(info) \ + ((struct frvfdpic_elf_link_hash_table *) ((info)->hash)) + +#define frvfdpic_got_section(info) \ + (frvfdpic_hash_table (info)->sgot) +#define frvfdpic_gotrel_section(info) \ + (frvfdpic_hash_table (info)->sgotrel) +#define frvfdpic_gotfixup_section(info) \ + (frvfdpic_hash_table (info)->sgotfixup) +#define frvfdpic_plt_section(info) \ + (frvfdpic_hash_table (info)->splt) +#define frvfdpic_pltrel_section(info) \ + (frvfdpic_hash_table (info)->spltrel) +#define frvfdpic_relocs_info(info) \ + (frvfdpic_hash_table (info)->relocs_info) +#define frvfdpic_got_initial_offset(info) \ + (frvfdpic_hash_table (info)->got0) +#define frvfdpic_plt_initial_offset(info) \ + (frvfdpic_hash_table (info)->plt0) /* Create an FRV ELF linker hash table. */ static struct bfd_link_hash_table * -frv_elf_link_hash_table_create (bfd *abfd) +frvfdpic_elf_link_hash_table_create (bfd *abfd) { - struct frv_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct frv_elf_link_hash_table); + struct frvfdpic_elf_link_hash_table *ret; + bfd_size_type amt = sizeof (struct frvfdpic_elf_link_hash_table); ret = bfd_zalloc (abfd, amt); if (ret == NULL) @@ -657,7 +659,7 @@ frv_elf_link_hash_table_create (bfd *abfd) /* Decide whether a reference to a symbol can be resolved locally or not. If the symbol is protected, we want the local address, but its function descriptor must be assigned by the dynamic linker. */ -#define FRV_SYM_LOCAL(INFO, H) \ +#define FRVFDPIC_SYM_LOCAL(INFO, H) \ (_bfd_elf_symbol_refs_local_p ((H), (INFO), 1) \ || ! elf_hash_table (INFO)->dynamic_sections_created \ || (/* The condition below is an ugly hack to get .scommon data to @@ -670,13 +672,13 @@ frv_elf_link_hash_table_create (bfd *abfd) || (H)->root.type == bfd_link_hash_defweak) \ && (H)->root.u.def.section->output_section \ && ((H)->root.u.def.section->flags & SEC_LINKER_CREATED))) -#define FRV_FUNCDESC_LOCAL(INFO, H) \ +#define FRVFDPIC_FUNCDESC_LOCAL(INFO, H) \ ((H)->dynindx == -1 || ! elf_hash_table (INFO)->dynamic_sections_created) /* This structure collects information on what kind of GOT, PLT or function descriptors are required by relocations that reference a certain symbol. */ -struct frv_pic_relocs_info +struct frvfdpic_relocs_info { /* The index of the symbol, as stored in the relocation r_info, if we have a local symbol; -1 otherwise. */ @@ -727,17 +729,17 @@ struct frv_pic_relocs_info unsigned sym:1; /* Whether we need a PLT entry for a symbol. Should be implied by something like: - (call && symndx == -1 && ! FRV_SYM_LOCAL (info, d.h)) */ + (call && symndx == -1 && ! FRVFDPIC_SYM_LOCAL (info, d.h)) */ unsigned plt:1; /* Whether a function descriptor should be created in this link unit for symbol+addend. Should be implied by something like: (plt || fdgotoff12 || fdgotofflos || fdgotofflohi || ((fd || fdgot12 || fdgotlos || fdgothilo) - && (symndx != -1 || FRV_FUNCDESC_LOCAL (info, d.h)))) */ + && (symndx != -1 || FRVFDPIC_FUNCDESC_LOCAL (info, d.h)))) */ unsigned privfd:1; /* Whether a lazy PLT entry is needed for this symbol+addend. Should be implied by something like: - (privfd && symndx == -1 && ! FRV_SYM_LOCAL (info, d.h) + (privfd && symndx == -1 && ! FRVFDPIC_SYM_LOCAL (info, d.h) && ! (info->flags & DF_BIND_NOW)) */ unsigned lazyplt:1; /* Whether we've already emitted GOT relocations and PLT entries as @@ -764,24 +766,24 @@ struct frv_pic_relocs_info bfd_vma plt_entry, lzplt_entry; }; -/* Compute a hash with the key fields of an frv_pic_relocs_info entry. */ +/* Compute a hash with the key fields of an frvfdpic_relocs_info entry. */ static hashval_t -frv_pic_relocs_info_hash (const void *entry_) +frvfdpic_relocs_info_hash (const void *entry_) { - const struct frv_pic_relocs_info *entry = entry_; + const struct frvfdpic_relocs_info *entry = entry_; return (entry->symndx == -1 ? entry->d.h->root.root.hash : entry->symndx + entry->d.abfd->id * 257) + entry->addend; } -/* Test whether the key fields of two frv_pic_relocs_info entries are +/* Test whether the key fields of two frvfdpic_relocs_info entries are identical. */ static int -frv_pic_relocs_info_eq (const void *entry1, const void *entry2) +frvfdpic_relocs_info_eq (const void *entry1, const void *entry2) { - const struct frv_pic_relocs_info *e1 = entry1; - const struct frv_pic_relocs_info *e2 = entry2; + const struct frvfdpic_relocs_info *e1 = entry1; + const struct frvfdpic_relocs_info *e2 = entry2; return e1->symndx == e2->symndx && e1->addend == e2->addend && (e1->symndx == -1 ? e1->d.h == e2->d.h : e1->d.abfd == e2->d.abfd); @@ -790,14 +792,14 @@ frv_pic_relocs_info_eq (const void *entry1, const void *entry2) /* Find or create an entry in a hash table HT that matches the key fields of the given ENTRY. If it's not found, memory for a new entry is allocated in ABFD's obstack. */ -static struct frv_pic_relocs_info * -frv_pic_relocs_info_find (struct htab *ht, - bfd *abfd, - const struct frv_pic_relocs_info *entry, - enum insert_option insert) +static struct frvfdpic_relocs_info * +frvfdpic_relocs_info_find (struct htab *ht, + bfd *abfd, + const struct frvfdpic_relocs_info *entry, + enum insert_option insert) { - struct frv_pic_relocs_info **loc = - (struct frv_pic_relocs_info **) htab_find_slot (ht, entry, insert); + struct frvfdpic_relocs_info **loc = + (struct frvfdpic_relocs_info **) htab_find_slot (ht, entry, insert); if (! loc) return NULL; @@ -822,47 +824,47 @@ frv_pic_relocs_info_find (struct htab *ht, /* Obtain the address of the entry in HT associated with H's symbol + addend, creating a new entry if none existed. ABFD is only used for memory allocation purposes. */ -inline static struct frv_pic_relocs_info * -frv_pic_relocs_info_for_global (struct htab *ht, - bfd *abfd, - struct elf_link_hash_entry *h, - bfd_vma addend, - enum insert_option insert) +inline static struct frvfdpic_relocs_info * +frvfdpic_relocs_info_for_global (struct htab *ht, + bfd *abfd, + struct elf_link_hash_entry *h, + bfd_vma addend, + enum insert_option insert) { - struct frv_pic_relocs_info entry; + struct frvfdpic_relocs_info entry; entry.symndx = -1; entry.d.h = h; entry.addend = addend; - return frv_pic_relocs_info_find (ht, abfd, &entry, insert); + return frvfdpic_relocs_info_find (ht, abfd, &entry, insert); } /* Obtain the address of the entry in HT associated with the SYMNDXth local symbol of the input bfd ABFD, plus the addend, creating a new entry if none existed. */ -inline static struct frv_pic_relocs_info * -frv_pic_relocs_info_for_local (struct htab *ht, - bfd *abfd, - long symndx, - bfd_vma addend, - enum insert_option insert) +inline static struct frvfdpic_relocs_info * +frvfdpic_relocs_info_for_local (struct htab *ht, + bfd *abfd, + long symndx, + bfd_vma addend, + enum insert_option insert) { - struct frv_pic_relocs_info entry; + struct frvfdpic_relocs_info entry; entry.symndx = symndx; entry.d.abfd = abfd; entry.addend = addend; - return frv_pic_relocs_info_find (ht, abfd, &entry, insert); + return frvfdpic_relocs_info_find (ht, abfd, &entry, insert); } /* Merge fields set by check_relocs() of two entries that end up being mapped to the same (presumably global) symbol. */ inline static void -frv_pic_merge_early_relocs_info (struct frv_pic_relocs_info *e2, - struct frv_pic_relocs_info const *e1) +frvfdpic_pic_merge_early_relocs_info (struct frvfdpic_relocs_info *e2, + struct frvfdpic_relocs_info const *e1) { e2->got12 |= e1->got12; e2->gotlos |= e1->gotlos; @@ -879,8 +881,8 @@ frv_pic_merge_early_relocs_info (struct frv_pic_relocs_info *e2, e2->sym |= e1->sym; #if 0 - /* These are set in _frv_count_got_plt_entries() or later, and this - function is only called in _frv_resolve_final_relocs_info(), that + /* These are set in _frvfdpic_count_got_plt_entries() or later, and this + function is only called in _frvfdpic_resolve_final_relocs_info(), that runs just before it, so we don't have to worry about the fields below. */ @@ -914,15 +916,15 @@ frv_pic_merge_early_relocs_info (struct frv_pic_relocs_info *e2, 32767, counting from 0). All other lazy PLT entries branch to it in a single instruction. */ -#define FRV_LZPLT_BLOCK_SIZE ((bfd_vma) 8 * 65535 + 4) -#define FRV_LZPLT_RESOLV_LOC (8 * 32767) +#define FRVFDPIC_LZPLT_BLOCK_SIZE ((bfd_vma) 8 * 65535 + 4) +#define FRVFDPIC_LZPLT_RESOLV_LOC (8 * 32767) /* Add a dynamic relocation to the SRELOC section. */ inline static bfd_vma -_frv_add_dyn_reloc (bfd *output_bfd, asection *sreloc, bfd_vma offset, - int reloc_type, long dynindx, bfd_vma addend, - struct frv_pic_relocs_info *entry) +_frvfdpic_add_dyn_reloc (bfd *output_bfd, asection *sreloc, bfd_vma offset, + int reloc_type, long dynindx, bfd_vma addend, + struct frvfdpic_relocs_info *entry) { Elf_Internal_Rela outrel; bfd_vma reloc_offset; @@ -946,8 +948,8 @@ _frv_add_dyn_reloc (bfd *output_bfd, asection *sreloc, bfd_vma offset, /* Add a fixup to the ROFIXUP section. */ static bfd_vma -_frv_add_rofixup (bfd *output_bfd, asection *rofixup, bfd_vma offset, - struct frv_pic_relocs_info *entry) +_frvfdpic_add_rofixup (bfd *output_bfd, asection *rofixup, bfd_vma offset, + struct frvfdpic_relocs_info *entry) { bfd_vma fixup_offset; @@ -975,7 +977,7 @@ _frv_add_rofixup (bfd *output_bfd, asection *rofixup, bfd_vma offset, located. */ static unsigned -_frv_osec_to_segment (bfd *output_bfd, asection *osec) +_frvfdpic_osec_to_segment (bfd *output_bfd, asection *osec) { struct elf_segment_map *m; Elf_Internal_Phdr *p; @@ -1000,9 +1002,9 @@ _frv_osec_to_segment (bfd *output_bfd, asection *osec) } inline static bfd_boolean -_frv_osec_readonly_p (bfd *output_bfd, asection *osec) +_frvfdpic_osec_readonly_p (bfd *output_bfd, asection *osec) { - unsigned seg = _frv_osec_to_segment (output_bfd, osec); + unsigned seg = _frvfdpic_osec_to_segment (output_bfd, osec); return ! (elf_tdata (output_bfd)->phdr[seg].p_flags & PF_W); } @@ -1011,12 +1013,12 @@ _frv_osec_readonly_p (bfd *output_bfd, asection *osec) code for PLT and lazy PLT entries. */ inline static bfd_boolean -_frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, - bfd *output_bfd, - struct bfd_link_info *info, - asection *sec, - Elf_Internal_Sym *sym, - bfd_vma addend) +_frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, + bfd *output_bfd, + struct bfd_link_info *info, + asection *sec, + Elf_Internal_Sym *sym, + bfd_vma addend) { bfd_vma fd_lazy_rel_offset = (bfd_vma)-1; @@ -1051,7 +1053,8 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, /* If the symbol is dynamic but binds locally, use section+offset. */ - if (sec && (entry->symndx != -1 || FRV_SYM_LOCAL (info, entry->d.h))) + if (sec && (entry->symndx != -1 + || FRVFDPIC_SYM_LOCAL (info, entry->d.h))) { if (entry->symndx == -1) ad += entry->d.h->root.u.def.value; @@ -1068,32 +1071,36 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, omit the dynamic relocation as long as the symbol is local to this module. */ if (info->executable && !info->pie - && (entry->symndx != -1 || FRV_SYM_LOCAL (info, entry->d.h))) + && (entry->symndx != -1 + || FRVFDPIC_SYM_LOCAL (info, entry->d.h))) { if (sec) ad += sec->output_section->vma; if (entry->symndx != -1 || entry->d.h->root.type != bfd_link_hash_undefweak) - _frv_add_rofixup (output_bfd, frv_gotfixup_section (info), - frv_got_section (info)->output_section->vma - + frv_got_section (info)->output_offset - + frv_got_initial_offset (info) - + entry->got_entry, entry); + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section (info), + frvfdpic_got_section (info)->output_section + ->vma + + frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info) + + entry->got_entry, entry); } else - _frv_add_dyn_reloc (output_bfd, frv_gotrel_section (info), - _bfd_elf_section_offset - (output_bfd, info, - frv_got_section (info), - frv_got_initial_offset (info) - + entry->got_entry) - + frv_got_section (info)->output_section->vma - + frv_got_section (info)->output_offset, - R_FRV_32, idx, ad, entry); + _frvfdpic_add_dyn_reloc (output_bfd, frvfdpic_gotrel_section (info), + _bfd_elf_section_offset + (output_bfd, info, + frvfdpic_got_section (info), + frvfdpic_got_initial_offset (info) + + entry->got_entry) + + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info)->output_offset, + R_FRV_32, idx, ad, entry); bfd_put_32 (output_bfd, ad, - frv_got_section (info)->contents - + frv_got_initial_offset (info) + frvfdpic_got_section (info)->contents + + frvfdpic_got_initial_offset (info) + entry->got_entry); } @@ -1106,7 +1113,7 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, if (! (entry->symndx == -1 && entry->d.h->root.type == bfd_link_hash_undefweak - && FRV_SYM_LOCAL (info, entry->d.h))) + && FRVFDPIC_SYM_LOCAL (info, entry->d.h))) { /* If the symbol is dynamic and there may be dynamic symbol resolution because we are, or are linked with, a shared @@ -1115,8 +1122,9 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, symbol needs a non-local function descriptor but binds locally (e.g., its visibility is protected, emit a dynamic relocation decayed to section+offset. */ - if (entry->symndx == -1 && ! FRV_FUNCDESC_LOCAL (info, entry->d.h) - && FRV_SYM_LOCAL (info, entry->d.h) + if (entry->symndx == -1 + && ! FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h) + && FRVFDPIC_SYM_LOCAL (info, entry->d.h) && !(info->executable && !info->pie)) { reloc = R_FRV_FUNCDESC; @@ -1126,7 +1134,7 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, + entry->d.h->root.u.def.value; } else if (entry->symndx == -1 - && ! FRV_FUNCDESC_LOCAL (info, entry->d.h)) + && ! FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h)) { reloc = R_FRV_FUNCDESC; idx = dynindx; @@ -1141,10 +1149,10 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, if (elf_hash_table (info)->dynamic_sections_created) BFD_ASSERT (entry->privfd); reloc = R_FRV_32; - idx = elf_section_data (frv_got_section (info) + idx = elf_section_data (frvfdpic_got_section (info) ->output_section)->dynindx; - ad = frv_got_section (info)->output_offset - + frv_got_initial_offset (info) + entry->fd_entry; + ad = frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info) + entry->fd_entry; } /* If there is room for dynamic symbol resolution, emit the @@ -1155,30 +1163,36 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, of the private descriptor ourselves. */ if (info->executable && !info->pie && (entry->symndx != -1 - || FRV_FUNCDESC_LOCAL (info, entry->d.h))) + || FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h))) { - ad += frv_got_section (info)->output_section->vma; - _frv_add_rofixup (output_bfd, frv_gotfixup_section (info), - frv_got_section (info)->output_section->vma - + frv_got_section (info)->output_offset - + frv_got_initial_offset (info) - + entry->fdgot_entry, entry); + ad += frvfdpic_got_section (info)->output_section->vma; + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section (info), + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info) + ->output_offset + + frvfdpic_got_initial_offset (info) + + entry->fdgot_entry, entry); } else - _frv_add_dyn_reloc (output_bfd, frv_gotrel_section (info), - _bfd_elf_section_offset - (output_bfd, info, - frv_got_section (info), - frv_got_initial_offset (info) - + entry->fdgot_entry) - + frv_got_section (info)->output_section->vma - + frv_got_section (info)->output_offset, - reloc, idx, ad, entry); + _frvfdpic_add_dyn_reloc (output_bfd, + frvfdpic_gotrel_section (info), + _bfd_elf_section_offset + (output_bfd, info, + frvfdpic_got_section (info), + frvfdpic_got_initial_offset (info) + + entry->fdgot_entry) + + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info) + ->output_offset, + reloc, idx, ad, entry); } bfd_put_32 (output_bfd, ad, - frv_got_section (info)->contents - + frv_got_initial_offset (info) + frvfdpic_got_section (info)->contents + + frvfdpic_got_initial_offset (info) + entry->fdgot_entry); } @@ -1193,7 +1207,8 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, /* If the symbol is dynamic but binds locally, use section+offset. */ - if (sec && (entry->symndx != -1 || FRV_SYM_LOCAL (info, entry->d.h))) + if (sec && (entry->symndx != -1 + || FRVFDPIC_SYM_LOCAL (info, entry->d.h))) { if (entry->symndx == -1) ad += entry->d.h->root.u.def.value; @@ -1210,7 +1225,7 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, omit the dynamic relocation as long as the symbol is local to this module. */ if (info->executable && !info->pie - && (entry->symndx != -1 || FRV_SYM_LOCAL (info, entry->d.h))) + && (entry->symndx != -1 || FRVFDPIC_SYM_LOCAL (info, entry->d.h))) { if (sec) ad += sec->output_section->vma; @@ -1218,32 +1233,41 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, if (entry->symndx != -1 || entry->d.h->root.type != bfd_link_hash_undefweak) { - _frv_add_rofixup (output_bfd, frv_gotfixup_section (info), - frv_got_section (info)->output_section->vma - + frv_got_section (info)->output_offset - + frv_got_initial_offset (info) - + entry->fd_entry, entry); - _frv_add_rofixup (output_bfd, frv_gotfixup_section (info), - frv_got_section (info)->output_section->vma - + frv_got_section (info)->output_offset - + frv_got_initial_offset (info) - + entry->fd_entry + 4, entry); + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section (info), + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info) + ->output_offset + + frvfdpic_got_initial_offset (info) + + entry->fd_entry, entry); + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section (info), + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info) + ->output_offset + + frvfdpic_got_initial_offset (info) + + entry->fd_entry + 4, entry); } } else { ofst = - _frv_add_dyn_reloc (output_bfd, - entry->lazyplt ? frv_pltrel_section (info) - : frv_gotrel_section (info), - _bfd_elf_section_offset - (output_bfd, info, - frv_got_section (info), - frv_got_initial_offset (info) - + entry->fd_entry) - + frv_got_section (info)->output_section->vma - + frv_got_section (info)->output_offset, - R_FRV_FUNCDESC_VALUE, idx, ad, entry); + _frvfdpic_add_dyn_reloc (output_bfd, + entry->lazyplt + ? frvfdpic_pltrel_section (info) + : frvfdpic_gotrel_section (info), + _bfd_elf_section_offset + (output_bfd, info, + frvfdpic_got_section (info), + frvfdpic_got_initial_offset (info) + + entry->fd_entry) + + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info) + ->output_offset, + R_FRV_FUNCDESC_VALUE, idx, ad, entry); } /* If we've omitted the dynamic relocation, just emit the fixed @@ -1251,9 +1275,9 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, if (info->executable && !info->pie && sec && sec->output_section) { lowword = ad; - highword = frv_got_section (info)->output_section->vma - + frv_got_section (info)->output_offset - + frv_got_initial_offset (info); + highword = frvfdpic_got_section (info)->output_section->vma + + frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info); } else if (entry->lazyplt) { @@ -1269,10 +1293,10 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, entry point, that must be within the memory region assigned to that section. */ lowword = entry->lzplt_entry + 4 - + frv_plt_section (info)->output_offset - + frv_plt_section (info)->output_section->vma; - highword = _frv_osec_to_segment - (output_bfd, frv_plt_section (info)->output_section); + + frvfdpic_plt_section (info)->output_offset + + frvfdpic_plt_section (info)->output_section->vma; + highword = _frvfdpic_osec_to_segment + (output_bfd, frvfdpic_plt_section (info)->output_section); } else { @@ -1284,23 +1308,25 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, && entry->d.h->dynindx == idx) highword = 0; else - highword = _frv_osec_to_segment (output_bfd, sec->output_section); + highword = _frvfdpic_osec_to_segment + (output_bfd, sec->output_section); } bfd_put_32 (output_bfd, lowword, - frv_got_section (info)->contents - + frv_got_initial_offset (info) + frvfdpic_got_section (info)->contents + + frvfdpic_got_initial_offset (info) + entry->fd_entry); bfd_put_32 (output_bfd, highword, - frv_got_section (info)->contents - + frv_got_initial_offset (info) + frvfdpic_got_section (info)->contents + + frvfdpic_got_initial_offset (info) + entry->fd_entry + 4); } /* Generate code for the PLT entry. */ if (entry->plt_entry != (bfd_vma) -1) { - bfd_byte *plt_code = frv_plt_section (info)->contents + entry->plt_entry; + bfd_byte *plt_code = frvfdpic_plt_section (info)->contents + + entry->plt_entry; BFD_ASSERT (entry->fd_entry); @@ -1353,17 +1379,17 @@ _frv_emit_got_relocs_plt_entries (struct frv_pic_relocs_info *entry, /* Generate code for the lazy PLT entry. */ if (entry->lzplt_entry != (bfd_vma) -1) { - bfd_byte *lzplt_code = frv_plt_section (info)->contents + bfd_byte *lzplt_code = frvfdpic_plt_section (info)->contents + entry->lzplt_entry; bfd_vma resolverStub_addr; bfd_put_32 (output_bfd, fd_lazy_rel_offset, lzplt_code); lzplt_code += 4; - resolverStub_addr = entry->lzplt_entry / FRV_LZPLT_BLOCK_SIZE - * FRV_LZPLT_BLOCK_SIZE + FRV_LZPLT_RESOLV_LOC; - if (resolverStub_addr >= frv_plt_initial_offset (info)) - resolverStub_addr = frv_plt_initial_offset (info) - 12; + resolverStub_addr = entry->lzplt_entry / FRVFDPIC_LZPLT_BLOCK_SIZE + * FRVFDPIC_LZPLT_BLOCK_SIZE + FRVFDPIC_LZPLT_RESOLV_LOC; + if (resolverStub_addr >= frvfdpic_plt_initial_offset (info)) + resolverStub_addr = frvfdpic_plt_initial_offset (info) - 12; if (entry->lzplt_entry == resolverStub_addr) { @@ -1767,8 +1793,8 @@ frv_info_to_howto_rela (abfd, cache_ptr, dst) /* Set the howto pointer for an FRV ELF REL reloc. */ static void -frv_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, - arelent *cache_ptr, Elf_Internal_Rela *dst) +frvfdpic_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, Elf_Internal_Rela *dst) { unsigned int r_type; @@ -1869,24 +1895,24 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; - isec_segment = _frv_osec_to_segment (output_bfd, - input_section->output_section); - if (frv_got_section (info)) - got_segment = _frv_osec_to_segment (output_bfd, - frv_got_section (info) - ->output_section); + isec_segment = _frvfdpic_osec_to_segment (output_bfd, + input_section->output_section); + if (IS_FDPIC (output_bfd) && frvfdpic_got_section (info)) + got_segment = _frvfdpic_osec_to_segment (output_bfd, + frvfdpic_got_section (info) + ->output_section); else got_segment = -1; - if (frv_gotfixup_section (info)) - gprel_segment = _frv_osec_to_segment (output_bfd, - frv_gotfixup_section (info) - ->output_section); + if (IS_FDPIC (output_bfd) && frvfdpic_gotfixup_section (info)) + gprel_segment = _frvfdpic_osec_to_segment (output_bfd, + frvfdpic_gotfixup_section (info) + ->output_section); else gprel_segment = -1; - if (elf_hash_table (info)->dynamic_sections_created) - plt_segment = _frv_osec_to_segment (output_bfd, - frv_plt_section (info) - ->output_section); + if (IS_FDPIC (output_bfd) && elf_hash_table (info)->dynamic_sections_created) + plt_segment = _frvfdpic_osec_to_segment (output_bfd, + frvfdpic_plt_section (info) + ->output_section); else plt_segment = -1; @@ -1902,7 +1928,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, const char * name = NULL; int r_type; asection *osec; - struct frv_pic_relocs_info *picrel; + struct frvfdpic_relocs_info *picrel; bfd_vma orig_addend = rel->r_addend; r_type = ELF32_R_TYPE (rel->r_info); @@ -1940,7 +1966,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) - && ! FRV_SYM_LOCAL (info, h)) + && ! FRVFDPIC_SYM_LOCAL (info, h)) { sec = NULL; relocation = 0; @@ -1978,6 +2004,9 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, { case R_FRV_LABEL24: case R_FRV_32: + if (! IS_FDPIC (output_bfd)) + goto non_fdpic; + case R_FRV_GOT12: case R_FRV_GOTHI: case R_FRV_GOTLO: @@ -1993,25 +2022,27 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, case R_FRV_FUNCDESC: case R_FRV_FUNCDESC_VALUE: if (h != NULL) - picrel = frv_pic_relocs_info_for_global (frv_relocs_info (info), - input_bfd, h, - orig_addend, INSERT); + picrel = frvfdpic_relocs_info_for_global (frvfdpic_relocs_info + (info), input_bfd, h, + orig_addend, INSERT); else /* In order to find the entry we created before, we must use the original addend, not the one that may have been modified by _bfd_elf_rela_local_sym(). */ - picrel = frv_pic_relocs_info_for_local (frv_relocs_info (info), - input_bfd, r_symndx, - orig_addend, INSERT); + picrel = frvfdpic_relocs_info_for_local (frvfdpic_relocs_info + (info), input_bfd, r_symndx, + orig_addend, INSERT); if (! picrel) return FALSE; - if (!_frv_emit_got_relocs_plt_entries (picrel, output_bfd, info, - osec, sym, rel->r_addend)) + if (!_frvfdpic_emit_got_relocs_plt_entries (picrel, output_bfd, info, + osec, sym, + rel->r_addend)) { - info->callbacks->warning - (info, _("Dynamic relocation references symbol with nonzero addend"), - name, input_bfd, input_section, rel->r_offset); + (*_bfd_error_handler) + (_("%s: relocation at `%s+0x%x' references symbol `%s' with nonzero addend"), + bfd_archive_filename (input_bfd), input_section->name, + rel->r_offset, name); return FALSE; } @@ -2019,8 +2050,9 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, break; default: + non_fdpic: picrel = NULL; - if (h && ! FRV_SYM_LOCAL (info, h)) + if (h && ! FRVFDPIC_SYM_LOCAL (info, h)) { info->callbacks->warning (info, _("relocation references symbol not defined in the module"), @@ -2034,10 +2066,12 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, { case R_FRV_LABEL24: check_segment[0] = isec_segment; - if (picrel->plt) + if (! IS_FDPIC (output_bfd)) + check_segment[1] = isec_segment; + else if (picrel->plt) { - relocation = frv_plt_section (info)->output_section->vma - + frv_plt_section (info)->output_offset + relocation = frvfdpic_plt_section (info)->output_section->vma + + frvfdpic_plt_section (info)->output_offset + picrel->plt_entry; check_segment[1] = plt_segment; } @@ -2050,7 +2084,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, check_segment[1] = check_segment[0]; else check_segment[1] = sec - ? _frv_osec_to_segment (output_bfd, sec->output_section) + ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) : (unsigned)-1; break; @@ -2071,12 +2105,12 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, case R_FRV_GOTOFFHI: case R_FRV_GOTOFF12: case R_FRV_GOTOFFLO: - relocation -= frv_got_section (info)->output_section->vma - + frv_got_section (info)->output_offset - + frv_got_initial_offset (info); + relocation -= frvfdpic_got_section (info)->output_section->vma + + frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info); check_segment[0] = got_segment; check_segment[1] = sec - ? _frv_osec_to_segment (output_bfd, sec->output_section) + ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) : (unsigned)-1; break; @@ -2093,7 +2127,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, bfd_vma addend = rel->r_addend; if (! (h && h->root.type == bfd_link_hash_undefweak - && FRV_SYM_LOCAL (info, h))) + && FRVFDPIC_SYM_LOCAL (info, h))) { /* If the symbol is dynamic and there may be dynamic symbol resolution because we are or are linked with a @@ -2103,8 +2137,8 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, descriptor but binds locally (e.g., its visibility is protected, emit a dynamic relocation decayed to section+offset. */ - if (h && ! FRV_FUNCDESC_LOCAL (info, h) - && FRV_SYM_LOCAL (info, h) + if (h && ! FRVFDPIC_FUNCDESC_LOCAL (info, h) + && FRVFDPIC_SYM_LOCAL (info, h) && !(info->executable && !info->pie)) { dynindx = elf_section_data (h->root.u.def.section @@ -2112,7 +2146,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, addend += h->root.u.def.section->output_offset + h->root.u.def.value; } - else if (h && ! FRV_FUNCDESC_LOCAL (info, h)) + else if (h && ! FRVFDPIC_FUNCDESC_LOCAL (info, h)) { if (addend) { @@ -2129,10 +2163,10 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, descriptor, so reference it directly. */ BFD_ASSERT (picrel->privfd); r_type = R_FRV_32; - dynindx = elf_section_data (frv_got_section (info) + dynindx = elf_section_data (frvfdpic_got_section (info) ->output_section)->dynindx; - addend = frv_got_section (info)->output_offset - + frv_got_initial_offset (info) + addend = frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info) + picrel->fd_entry; } @@ -2143,15 +2177,16 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, be zero, which means we can and should compute the address of the private descriptor ourselves. */ if (info->executable && !info->pie - && (!h || FRV_FUNCDESC_LOCAL (info, h))) + && (!h || FRVFDPIC_FUNCDESC_LOCAL (info, h))) { - addend += frv_got_section (info)->output_section->vma; + addend += frvfdpic_got_section (info)->output_section->vma; if ((bfd_get_section_flags (output_bfd, input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { - if (_frv_osec_readonly_p (output_bfd, - input_section->output_section)) + if (_frvfdpic_osec_readonly_p (output_bfd, + input_section + ->output_section)) { info->callbacks->warning (info, @@ -2159,22 +2194,25 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, name, input_bfd, input_section, rel->r_offset); return FALSE; } - _frv_add_rofixup (output_bfd, - frv_gotfixup_section (info), - _bfd_elf_section_offset - (output_bfd, info, - input_section, rel->r_offset) - + input_section->output_section->vma - + input_section->output_offset, - picrel); + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section + (info), + _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset) + + input_section + ->output_section->vma + + input_section->output_offset, + picrel); } } else if ((bfd_get_section_flags (output_bfd, input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { - if (_frv_osec_readonly_p (output_bfd, - input_section->output_section)) + if (_frvfdpic_osec_readonly_p (output_bfd, + input_section + ->output_section)) { info->callbacks->warning (info, @@ -2182,14 +2220,18 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, name, input_bfd, input_section, rel->r_offset); return FALSE; } - _frv_add_dyn_reloc (output_bfd, frv_gotrel_section (info), - _bfd_elf_section_offset - (output_bfd, info, - input_section, rel->r_offset) - + input_section->output_section->vma - + input_section->output_offset, - r_type, dynindx, addend, picrel); + _frvfdpic_add_dyn_reloc (output_bfd, + frvfdpic_gotrel_section (info), + _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset) + + input_section + ->output_section->vma + + input_section->output_offset, + r_type, dynindx, addend, picrel); } + else + addend += frvfdpic_got_section (info)->output_section->vma; } /* We want the addend in-place because dynamic @@ -2201,6 +2243,12 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, break; case R_FRV_32: + if (! IS_FDPIC (output_bfd)) + { + check_segment[0] = check_segment[1] = -1; + break; + } + /* Fall through. */ case R_FRV_FUNCDESC_VALUE: { int dynindx; @@ -2208,7 +2256,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, /* If the symbol is dynamic but binds locally, use section+offset. */ - if (h && ! FRV_SYM_LOCAL (info, h)) + if (h && ! FRVFDPIC_SYM_LOCAL (info, h)) { if (addend && r_type == R_FRV_FUNCDESC_VALUE) { @@ -2240,17 +2288,18 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, is defined in the current link unit (which is implied by its output section not being NULL). */ if (info->executable && !info->pie - && (!h || FRV_SYM_LOCAL (info, h))) + && (!h || FRVFDPIC_SYM_LOCAL (info, h))) { if (osec) addend += osec->output_section->vma; - if ((elf_elfheader (input_bfd)->e_flags & EF_FRV_FDPIC) + if (IS_FDPIC (input_bfd) && (bfd_get_section_flags (output_bfd, input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { - if (_frv_osec_readonly_p (output_bfd, - input_section->output_section)) + if (_frvfdpic_osec_readonly_p (output_bfd, + input_section + ->output_section)) { info->callbacks->warning (info, @@ -2260,18 +2309,20 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, } if (!h || h->root.type != bfd_link_hash_undefweak) { - _frv_add_rofixup (output_bfd, - frv_gotfixup_section (info), - _bfd_elf_section_offset - (output_bfd, info, - input_section, rel->r_offset) - + input_section->output_section->vma - + input_section->output_offset, - picrel); + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section + (info), + _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset) + + input_section + ->output_section->vma + + input_section->output_offset, + picrel); if (r_type == R_FRV_FUNCDESC_VALUE) - _frv_add_rofixup + _frvfdpic_add_rofixup (output_bfd, - frv_gotfixup_section (info), + frvfdpic_gotfixup_section (info), _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset) @@ -2286,8 +2337,9 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { - if (_frv_osec_readonly_p (output_bfd, - input_section->output_section)) + if (_frvfdpic_osec_readonly_p (output_bfd, + input_section + ->output_section)) { info->callbacks->warning (info, @@ -2295,14 +2347,18 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, name, input_bfd, input_section, rel->r_offset); return FALSE; } - _frv_add_dyn_reloc (output_bfd, frv_gotrel_section (info), - _bfd_elf_section_offset - (output_bfd, info, - input_section, rel->r_offset) - + input_section->output_section->vma - + input_section->output_offset, - r_type, dynindx, addend, picrel); + _frvfdpic_add_dyn_reloc (output_bfd, + frvfdpic_gotrel_section (info), + _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset) + + input_section + ->output_section->vma + + input_section->output_offset, + r_type, dynindx, addend, picrel); } + else if (osec) + addend += osec->output_section->vma; /* We want the addend in-place because dynamic relocations are REL. Setting relocation to it should arrange for it to be installed. */ @@ -2315,11 +2371,11 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, the fixed addresses of the symbol and of the local GOT base offset. */ if (info->executable && !info->pie - && (!h || FRV_SYM_LOCAL (info, h))) + && (!h || FRVFDPIC_SYM_LOCAL (info, h))) bfd_put_32 (output_bfd, - frv_got_section (info)->output_section->vma - + frv_got_section (info)->output_offset - + frv_got_initial_offset (info), + frvfdpic_got_section (info)->output_section->vma + + frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info), contents + rel->r_offset + 4); else /* A function descriptor used for lazy or local @@ -2329,10 +2385,11 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, contains the offset of the lazy PLT entry entry point into that section. */ bfd_put_32 (output_bfd, - h && ! FRV_SYM_LOCAL (info, h) + h && ! FRVFDPIC_SYM_LOCAL (info, h) ? 0 - : _frv_osec_to_segment (output_bfd, - sec->output_section), + : _frvfdpic_osec_to_segment (output_bfd, + sec + ->output_section), contents + rel->r_offset + 4); } } @@ -2346,22 +2403,22 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, case R_FRV_GPRELLO: check_segment[0] = gprel_segment; check_segment[1] = sec - ? _frv_osec_to_segment (output_bfd, sec->output_section) + ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) : (unsigned)-1; break; default: check_segment[0] = isec_segment; check_segment[1] = sec - ? _frv_osec_to_segment (output_bfd, sec->output_section) + ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) : (unsigned)-1; break; } - if (check_segment[0] != check_segment[1] - && (elf_elfheader (output_bfd)->e_flags & EF_FRV_FDPIC)) + if (check_segment[0] != check_segment[1] && IS_FDPIC (output_bfd)) { -#if 1 +#if 1 /* If you take this out, remove the #error from fdpic-static-6.d + in the ld testsuite. */ /* This helps catch problems in GCC while we can't do more than static linking. The idea is to test whether the input file basename is crt0.o only once. */ @@ -2418,7 +2475,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, switch (r_type) { case R_FRV_LABEL24: - if (! picrel->plt) + if (! IS_FDPIC (output_bfd) || ! picrel->plt) break; /* Fall through. */ @@ -2615,7 +2672,8 @@ elf32_frv_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) return TRUE; } -/* Create a .got section, as well as its additional info field. This + +/* Create a .got section, as well as its additional info field. This is almost entirely copied from elflink.c:_bfd_elf_create_got_section(). */ @@ -2628,6 +2686,7 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info) struct bfd_link_hash_entry *bh; const struct elf_backend_data *bed = get_elf_backend_data (abfd); int ptralign; + int offset; /* This function may be called more than once. */ s = bfd_get_section_by_name (abfd, ".got"); @@ -2687,36 +2746,46 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info) /* This is the machine-specific part. Create and initialize section data for the got. */ - frv_got_section (info) = s; - frv_relocs_info (info) = htab_try_create (1, frv_pic_relocs_info_hash, - frv_pic_relocs_info_eq, - (htab_del) NULL); - if (! frv_relocs_info (info)) - return FALSE; + if (IS_FDPIC (abfd)) + { + frvfdpic_got_section (info) = s; + frvfdpic_relocs_info (info) = htab_try_create (1, frvfdpic_relocs_info_hash, + frvfdpic_relocs_info_eq, + (htab_del) NULL); + if (! frvfdpic_relocs_info (info)) + return FALSE; - s = bfd_make_section (abfd, ".rel.got"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, (flags | SEC_READONLY)) - || ! bfd_set_section_alignment (abfd, s, 2)) - return FALSE; + s = bfd_make_section (abfd, ".rel.got"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, (flags | SEC_READONLY)) + || ! bfd_set_section_alignment (abfd, s, 2)) + return FALSE; - frv_gotrel_section (info) = s; + frvfdpic_gotrel_section (info) = s; - /* Machine-specific. */ - s = bfd_make_section (abfd, ".rofixup"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, (flags | SEC_READONLY)) - || ! bfd_set_section_alignment (abfd, s, 2)) - return FALSE; + /* Machine-specific. */ + s = bfd_make_section (abfd, ".rofixup"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, (flags | SEC_READONLY)) + || ! bfd_set_section_alignment (abfd, s, 2)) + return FALSE; - frv_gotfixup_section (info) = s; + frvfdpic_gotfixup_section (info) = s; + offset = -2048; + flags = BSF_GLOBAL; + } + else + { + offset = 2048; + flags = BSF_GLOBAL | BSF_WEAK; + } - /* Define _gp in .rofixup, for FDPIC. If it turns out that - we're linking with a different linker script, the linker script - will override it. */ + /* Define _gp in .rofixup, for FDPIC, or .got otherwise. If it + turns out that we're linking with a different linker script, the + linker script will override it. */ bh = NULL; if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "_gp", BSF_GLOBAL, s, -2048, (const char *) NULL, FALSE, + (info, abfd, "_gp", flags, s, offset, (const char *) NULL, FALSE, bed->collect, &bh))) return FALSE; h = (struct elf_link_hash_entry *) bh; @@ -2724,9 +2793,9 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info) h->type = STT_OBJECT; /* Machine-specific: we want the symbol for executables as well. */ - if (! bfd_elf_link_record_dynamic_symbol (info, h)) + if (IS_FDPIC (abfd) && ! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; - + return TRUE; } @@ -2734,7 +2803,7 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info) the link hash table point to them. */ static bfd_boolean -elf32_frv_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) +elf32_frvfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) { /* This is mostly copied from elflink.c:_bfd_elf_create_dynamic_sections(). */ @@ -2761,7 +2830,7 @@ elf32_frv_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) return FALSE; /* FRV-specific: remember it. */ - frv_plt_section (info) = s; + frvfdpic_plt_section (info) = s; if (bed->want_plt_sym) { @@ -2790,16 +2859,17 @@ elf32_frv_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) return FALSE; /* FRV-specific: remember it. */ - frv_pltrel_section (info) = s; + frvfdpic_pltrel_section (info) = s; /* FRV-specific: we want to create the GOT in the FRV way. */ if (! _frv_create_got_section (abfd, info)) return FALSE; /* FRV-specific: make sure we created everything we wanted. */ - BFD_ASSERT (frv_got_section (info) && frv_gotrel_section (info) - && frv_gotfixup_section (info) - && frv_plt_section (info) && frv_pltrel_section (info)); + BFD_ASSERT (frvfdpic_got_section (info) && frvfdpic_gotrel_section (info) + && frvfdpic_gotfixup_section (info) + && frvfdpic_plt_section (info) + && frvfdpic_pltrel_section (info)); if (bed->want_dynbss) { @@ -2849,7 +2919,7 @@ elf32_frv_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) /* This structure is used to collect the number of entries present in each addressable range of the got. */ -struct _frv_dynamic_got_info +struct _frvfdpic_dynamic_got_info { /* Several bits of information about the current link. */ struct bfd_link_info *info; @@ -2877,10 +2947,10 @@ struct _frv_dynamic_got_info private function descriptors taking two words. */ static int -_frv_count_got_plt_entries (void **entryp, void *dinfo_) +_frvfdpic_count_got_plt_entries (void **entryp, void *dinfo_) { - struct frv_pic_relocs_info *entry = *entryp; - struct _frv_dynamic_got_info *dinfo = dinfo_; + struct frvfdpic_relocs_info *entry = *entryp; + struct _frvfdpic_dynamic_got_info *dinfo = dinfo_; unsigned relocs = 0, fixups = 0; /* Allocate space for a GOT entry pointing to the symbol. */ @@ -2909,15 +2979,15 @@ _frv_count_got_plt_entries (void **entryp, void *dinfo_) /* Decide whether we need a PLT entry, a function descriptor in the GOT, and a lazy PLT entry for this symbol. */ entry->plt = entry->call - && entry->symndx == -1 && ! FRV_SYM_LOCAL (dinfo->info, entry->d.h) + && entry->symndx == -1 && ! FRVFDPIC_SYM_LOCAL (dinfo->info, entry->d.h) && elf_hash_table (dinfo->info)->dynamic_sections_created; entry->privfd = entry->plt || entry->fdgoff12 || entry->fdgofflos || entry->fdgoffhilo || ((entry->fd || entry->fdgot12 || entry->fdgotlos || entry->fdgothilo) && (entry->symndx != -1 - || FRV_FUNCDESC_LOCAL (dinfo->info, entry->d.h))); + || FRVFDPIC_FUNCDESC_LOCAL (dinfo->info, entry->d.h))); entry->lazyplt = entry->privfd - && entry->symndx == -1 && ! FRV_SYM_LOCAL (dinfo->info, entry->d.h) + && entry->symndx == -1 && ! FRVFDPIC_SYM_LOCAL (dinfo->info, entry->d.h) && ! (dinfo->info->flags & DF_BIND_NOW) && elf_hash_table (dinfo->info)->dynamic_sections_created; @@ -2941,7 +3011,7 @@ _frv_count_got_plt_entries (void **entryp, void *dinfo_) relocs = entry->relocs32 + entry->relocsfd + entry->relocsfdv; else { - if (entry->symndx != -1 || FRV_SYM_LOCAL (dinfo->info, entry->d.h)) + if (entry->symndx != -1 || FRVFDPIC_SYM_LOCAL (dinfo->info, entry->d.h)) { if (entry->symndx != -1 || entry->d.h->root.type != bfd_link_hash_undefweak) @@ -2950,7 +3020,8 @@ _frv_count_got_plt_entries (void **entryp, void *dinfo_) else relocs += entry->relocs32 + entry->relocsfdv; - if (entry->symndx != -1 || FRV_FUNCDESC_LOCAL (dinfo->info, entry->d.h)) + if (entry->symndx != -1 + || FRVFDPIC_FUNCDESC_LOCAL (dinfo->info, entry->d.h)) { if (entry->symndx != -1 || entry->d.h->root.type != bfd_link_hash_undefweak) @@ -2971,10 +3042,10 @@ _frv_count_got_plt_entries (void **entryp, void *dinfo_) /* This structure is used to assign offsets to got entries, function descriptors, plt entries and lazy plt entries. */ -struct _frv_dynamic_got_plt_info +struct _frvfdpic_dynamic_got_plt_info { - /* Summary information collected with _frv_count_got_plt_entries. */ - struct _frv_dynamic_got_info g; + /* Summary information collected with _frvfdpic_count_got_plt_entries. */ + struct _frvfdpic_dynamic_got_info g; /* For each addressable range, we record a MAX (positive) and MIN (negative) value. CUR is used to assign got entries, and it's @@ -2990,7 +3061,7 @@ struct _frv_dynamic_got_plt_info descriptor is chosen. FDPLT indicates the number of remaining slots that can be used for function descriptors used only by PLT entries. */ - struct _frv_dynamic_got_alloc_data + struct _frvfdpic_dynamic_got_alloc_data { bfd_signed_vma max, cur, odd, fdcur, min; bfd_vma fdplt; @@ -3008,14 +3079,14 @@ struct _frv_dynamic_got_plt_info descriptors. */ inline static bfd_signed_vma -_frv_compute_got_alloc_data (struct _frv_dynamic_got_alloc_data *gad, - bfd_signed_vma fdcur, - bfd_signed_vma odd, - bfd_signed_vma cur, - bfd_vma got, - bfd_vma fd, - bfd_vma fdplt, - bfd_vma wrap) +_frvfdpic_compute_got_alloc_data (struct _frvfdpic_dynamic_got_alloc_data *gad, + bfd_signed_vma fdcur, + bfd_signed_vma odd, + bfd_signed_vma cur, + bfd_vma got, + bfd_vma fd, + bfd_vma fdplt, + bfd_vma wrap) { bfd_signed_vma wrapmin = -wrap; @@ -3109,7 +3180,7 @@ _frv_compute_got_alloc_data (struct _frv_dynamic_got_alloc_data *gad, if (odd > gad->max) odd = gad->min + odd - gad->max; - /* _frv_get_got_entry() below will always wrap gad->cur if needed + /* _frvfdpic_get_got_entry() below will always wrap gad->cur if needed before returning, so do it here too. This guarantees that, should cur and fdcur meet at the wrap point, they'll both be equal to min. */ @@ -3123,7 +3194,7 @@ _frv_compute_got_alloc_data (struct _frv_dynamic_got_alloc_data *gad, data for a range. */ inline static bfd_signed_vma -_frv_get_got_entry (struct _frv_dynamic_got_alloc_data *gad) +_frvfdpic_get_got_entry (struct _frvfdpic_dynamic_got_alloc_data *gad) { bfd_signed_vma ret; @@ -3152,7 +3223,7 @@ _frv_get_got_entry (struct _frv_dynamic_got_alloc_data *gad) GOT, given the allocation data for a range. */ inline static bfd_signed_vma -_frv_get_fd_entry (struct _frv_dynamic_got_alloc_data *gad) +_frvfdpic_get_fd_entry (struct _frvfdpic_dynamic_got_alloc_data *gad) { /* If we're at the bottom, wrap around, and only then allocate the next pair of words. */ @@ -3165,46 +3236,46 @@ _frv_get_fd_entry (struct _frv_dynamic_got_alloc_data *gad) Doing everything in a single pass is tricky. */ static int -_frv_assign_got_entries (void **entryp, void *info_) +_frvfdpic_assign_got_entries (void **entryp, void *info_) { - struct frv_pic_relocs_info *entry = *entryp; - struct _frv_dynamic_got_plt_info *dinfo = info_; + struct frvfdpic_relocs_info *entry = *entryp; + struct _frvfdpic_dynamic_got_plt_info *dinfo = info_; if (entry->got12) - entry->got_entry = _frv_get_got_entry (&dinfo->got12); + entry->got_entry = _frvfdpic_get_got_entry (&dinfo->got12); else if (entry->gotlos) - entry->got_entry = _frv_get_got_entry (&dinfo->gotlos); + entry->got_entry = _frvfdpic_get_got_entry (&dinfo->gotlos); else if (entry->gothilo) - entry->got_entry = _frv_get_got_entry (&dinfo->gothilo); + entry->got_entry = _frvfdpic_get_got_entry (&dinfo->gothilo); if (entry->fdgot12) - entry->fdgot_entry = _frv_get_got_entry (&dinfo->got12); + entry->fdgot_entry = _frvfdpic_get_got_entry (&dinfo->got12); else if (entry->fdgotlos) - entry->fdgot_entry = _frv_get_got_entry (&dinfo->gotlos); + entry->fdgot_entry = _frvfdpic_get_got_entry (&dinfo->gotlos); else if (entry->fdgothilo) - entry->fdgot_entry = _frv_get_got_entry (&dinfo->gothilo); + entry->fdgot_entry = _frvfdpic_get_got_entry (&dinfo->gothilo); if (entry->fdgoff12) - entry->fd_entry = _frv_get_fd_entry (&dinfo->got12); + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->got12); else if (entry->plt && dinfo->got12.fdplt) { dinfo->got12.fdplt -= 8; - entry->fd_entry = _frv_get_fd_entry (&dinfo->got12); + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->got12); } else if (entry->fdgofflos) - entry->fd_entry = _frv_get_fd_entry (&dinfo->gotlos); + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gotlos); else if (entry->plt && dinfo->gotlos.fdplt) { dinfo->gotlos.fdplt -= 8; - entry->fd_entry = _frv_get_fd_entry (&dinfo->gotlos); + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gotlos); } else if (entry->plt) { dinfo->gothilo.fdplt -= 8; - entry->fd_entry = _frv_get_fd_entry (&dinfo->gothilo); + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); } else if (entry->privfd) - entry->fd_entry = _frv_get_fd_entry (&dinfo->gothilo); + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); return 1; } @@ -3214,10 +3285,10 @@ _frv_assign_got_entries (void **entryp, void *info_) and lazy PLT entries. */ static int -_frv_assign_plt_entries (void **entryp, void *info_) +_frvfdpic_assign_plt_entries (void **entryp, void *info_) { - struct frv_pic_relocs_info *entry = *entryp; - struct _frv_dynamic_got_plt_info *dinfo = info_; + struct frvfdpic_relocs_info *entry = *entryp; + struct _frvfdpic_dynamic_got_plt_info *dinfo = info_; /* If this symbol requires a local function descriptor, allocate one. */ @@ -3225,18 +3296,18 @@ _frv_assign_plt_entries (void **entryp, void *info_) { if (dinfo->got12.fdplt) { - entry->fd_entry = _frv_get_fd_entry (&dinfo->got12); + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->got12); dinfo->got12.fdplt -= 8; } else if (dinfo->gotlos.fdplt) { - entry->fd_entry = _frv_get_fd_entry (&dinfo->gotlos); + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gotlos); dinfo->gotlos.fdplt -= 8; } else { BFD_ASSERT (dinfo->gothilo.fdplt) - entry->fd_entry = _frv_get_fd_entry (&dinfo->gothilo); + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); dinfo->gothilo.fdplt -= 8; } } @@ -3247,7 +3318,7 @@ _frv_assign_plt_entries (void **entryp, void *info_) /* We use the section's raw size to mark the location of the next PLT entry. */ - entry->plt_entry = frv_plt_section (dinfo->g.info)->_raw_size; + entry->plt_entry = frvfdpic_plt_section (dinfo->g.info)->_raw_size; /* Figure out the length of this PLT entry based on the addressing mode we need to reach the function descriptor. */ @@ -3261,7 +3332,7 @@ _frv_assign_plt_entries (void **entryp, void *info_) else size = 16; - frv_plt_section (dinfo->g.info)->_raw_size += size; + frvfdpic_plt_section (dinfo->g.info)->_raw_size += size; } if (entry->lazyplt) @@ -3270,7 +3341,8 @@ _frv_assign_plt_entries (void **entryp, void *info_) dinfo->g.lzplt += 8; /* If this entry is the one that gets the resolver stub, account for the additional instruction. */ - if (entry->lzplt_entry % FRV_LZPLT_BLOCK_SIZE == FRV_LZPLT_RESOLV_LOC) + if (entry->lzplt_entry % FRVFDPIC_LZPLT_BLOCK_SIZE + == FRVFDPIC_LZPLT_RESOLV_LOC) dinfo->g.lzplt += 4; } @@ -3284,15 +3356,15 @@ _frv_assign_plt_entries (void **entryp, void *info_) we've made a potentially-destructive change to the hash table, so the traversal must be restarted. */ static int -_frv_resolve_final_relocs_info (void **entryp, void *p) +_frvfdpic_resolve_final_relocs_info (void **entryp, void *p) { - struct frv_pic_relocs_info *entry = *entryp; + struct frvfdpic_relocs_info *entry = *entryp; htab_t *htab = p; if (entry->symndx == -1) { struct elf_link_hash_entry *h = entry->d.h; - struct frv_pic_relocs_info *oentry; + struct frvfdpic_relocs_info *oentry; while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) @@ -3301,13 +3373,13 @@ _frv_resolve_final_relocs_info (void **entryp, void *p) if (entry->d.h == h) return 1; - oentry = frv_pic_relocs_info_for_global (*htab, 0, h, entry->addend, - NO_INSERT); + oentry = frvfdpic_relocs_info_for_global (*htab, 0, h, entry->addend, + NO_INSERT); if (oentry) { /* Merge the two entries. */ - frv_pic_merge_early_relocs_info (oentry, entry); + frvfdpic_pic_merge_early_relocs_info (oentry, entry); htab_clear_slot (*htab, entryp); return 1; } @@ -3336,12 +3408,12 @@ _frv_resolve_final_relocs_info (void **entryp, void *p) /* Set the sizes of the dynamic sections. */ static bfd_boolean -elf32_frv_size_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info) +elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) { bfd *dynobj; asection *s; - struct _frv_dynamic_got_plt_info gpinfo; + struct _frvfdpic_dynamic_got_plt_info gpinfo; bfd_signed_vma odd; bfd_vma limit; @@ -3365,15 +3437,15 @@ elf32_frv_size_dynamic_sections (bfd *output_bfd, for (;;) { - htab_t relocs = frv_relocs_info (info); + htab_t relocs = frvfdpic_relocs_info (info); - htab_traverse (relocs, _frv_resolve_final_relocs_info, &relocs); + htab_traverse (relocs, _frvfdpic_resolve_final_relocs_info, &relocs); - if (relocs == frv_relocs_info (info)) + if (relocs == frvfdpic_relocs_info (info)) break; } - htab_traverse (frv_relocs_info (info), _frv_count_got_plt_entries, + htab_traverse (frvfdpic_relocs_info (info), _frvfdpic_count_got_plt_entries, &gpinfo.g); odd = 12; @@ -3392,160 +3464,167 @@ elf32_frv_size_dynamic_sections (bfd *output_bfd, /* Determine the ranges of GOT offsets that we can use for each range of addressing modes. */ - odd = _frv_compute_got_alloc_data (&gpinfo.got12, - 0, - odd, - 16, - gpinfo.g.got12, - gpinfo.g.fd12, - limit, - (bfd_vma)1 << (12-1)); - odd = _frv_compute_got_alloc_data (&gpinfo.gotlos, - gpinfo.got12.min, - odd, - gpinfo.got12.max, - gpinfo.g.gotlos, - gpinfo.g.fdlos, - gpinfo.g.fdplt - gpinfo.got12.fdplt, - (bfd_vma)1 << (16-1)); - odd = _frv_compute_got_alloc_data (&gpinfo.gothilo, - gpinfo.gotlos.min, - odd, - gpinfo.gotlos.max, - gpinfo.g.gothilo, - gpinfo.g.fdhilo, - gpinfo.g.fdplt - gpinfo.got12.fdplt - - gpinfo.gotlos.fdplt, - (bfd_vma)1 << (32-1)); + odd = _frvfdpic_compute_got_alloc_data (&gpinfo.got12, + 0, + odd, + 16, + gpinfo.g.got12, + gpinfo.g.fd12, + limit, + (bfd_vma)1 << (12-1)); + odd = _frvfdpic_compute_got_alloc_data (&gpinfo.gotlos, + gpinfo.got12.min, + odd, + gpinfo.got12.max, + gpinfo.g.gotlos, + gpinfo.g.fdlos, + gpinfo.g.fdplt - gpinfo.got12.fdplt, + (bfd_vma)1 << (16-1)); + odd = _frvfdpic_compute_got_alloc_data (&gpinfo.gothilo, + gpinfo.gotlos.min, + odd, + gpinfo.gotlos.max, + gpinfo.g.gothilo, + gpinfo.g.fdhilo, + gpinfo.g.fdplt - gpinfo.got12.fdplt + - gpinfo.gotlos.fdplt, + (bfd_vma)1 << (32-1)); /* Now assign (most) GOT offsets. */ - htab_traverse (frv_relocs_info (info), _frv_assign_got_entries, &gpinfo); + htab_traverse (frvfdpic_relocs_info (info), _frvfdpic_assign_got_entries, + &gpinfo); - frv_got_section (info)->_raw_size = gpinfo.gothilo.max - gpinfo.gothilo.min + frvfdpic_got_section (info)->_raw_size = gpinfo.gothilo.max + - gpinfo.gothilo.min /* If an odd word is the last word of the GOT, we don't need this word to be part of the GOT. */ - (odd + 4 == gpinfo.gothilo.max ? 4 : 0); - if (frv_got_section (info)->_raw_size == 0) - frv_got_section (info)->flags |= SEC_EXCLUDE; - else if (frv_got_section (info)->_raw_size == 12 + if (frvfdpic_got_section (info)->_raw_size == 0) + frvfdpic_got_section (info)->flags |= SEC_EXCLUDE; + else if (frvfdpic_got_section (info)->_raw_size == 12 && ! elf_hash_table (info)->dynamic_sections_created) { - frv_got_section (info)->flags |= SEC_EXCLUDE; - frv_got_section (info)->_raw_size = 0; + frvfdpic_got_section (info)->flags |= SEC_EXCLUDE; + frvfdpic_got_section (info)->_raw_size = 0; } else { - frv_got_section (info)->contents = - (bfd_byte *) bfd_zalloc (dynobj, frv_got_section (info)->_raw_size); - if (frv_got_section (info)->contents == NULL) + frvfdpic_got_section (info)->contents = + (bfd_byte *) bfd_zalloc (dynobj, + frvfdpic_got_section (info)->_raw_size); + if (frvfdpic_got_section (info)->contents == NULL) return FALSE; } if (elf_hash_table (info)->dynamic_sections_created) /* Subtract the number of lzplt entries, since those will generate relocations in the pltrel section. */ - frv_gotrel_section (info)->_raw_size = + frvfdpic_gotrel_section (info)->_raw_size = (gpinfo.g.relocs - gpinfo.g.lzplt / 8) * get_elf_backend_data (output_bfd)->s->sizeof_rel; else BFD_ASSERT (gpinfo.g.relocs == 0); - if (frv_gotrel_section (info)->_raw_size == 0) - frv_gotrel_section (info)->flags |= SEC_EXCLUDE; + if (frvfdpic_gotrel_section (info)->_raw_size == 0) + frvfdpic_gotrel_section (info)->flags |= SEC_EXCLUDE; else { - frv_gotrel_section (info)->contents = - (bfd_byte *) bfd_zalloc (dynobj, frv_gotrel_section (info)->_raw_size); - if (frv_gotrel_section (info)->contents == NULL) + frvfdpic_gotrel_section (info)->contents = + (bfd_byte *) bfd_zalloc (dynobj, + frvfdpic_gotrel_section (info)->_raw_size); + if (frvfdpic_gotrel_section (info)->contents == NULL) return FALSE; } - if (elf_elfheader (output_bfd)->e_flags & EF_FRV_FDPIC) - frv_gotfixup_section (info)->_raw_size = (gpinfo.g.fixups + 1) * 4; - if (frv_gotfixup_section (info)->_raw_size == 0) - frv_gotfixup_section (info)->flags |= SEC_EXCLUDE; + frvfdpic_gotfixup_section (info)->_raw_size = (gpinfo.g.fixups + 1) * 4; + if (frvfdpic_gotfixup_section (info)->_raw_size == 0) + frvfdpic_gotfixup_section (info)->flags |= SEC_EXCLUDE; else { - frv_gotfixup_section (info)->contents = + frvfdpic_gotfixup_section (info)->contents = (bfd_byte *) bfd_zalloc (dynobj, - frv_gotfixup_section (info)->_raw_size); - if (frv_gotfixup_section (info)->contents == NULL) + frvfdpic_gotfixup_section (info)->_raw_size); + if (frvfdpic_gotfixup_section (info)->contents == NULL) return FALSE; } if (elf_hash_table (info)->dynamic_sections_created) { - frv_pltrel_section (info)->_raw_size = + frvfdpic_pltrel_section (info)->_raw_size = gpinfo.g.lzplt / 8 * get_elf_backend_data (output_bfd)->s->sizeof_rel; - if (frv_pltrel_section (info)->_raw_size == 0) - frv_pltrel_section (info)->flags |= SEC_EXCLUDE; + if (frvfdpic_pltrel_section (info)->_raw_size == 0) + frvfdpic_pltrel_section (info)->flags |= SEC_EXCLUDE; else { - frv_pltrel_section (info)->contents = + frvfdpic_pltrel_section (info)->contents = (bfd_byte *) bfd_zalloc (dynobj, - frv_pltrel_section (info)->_raw_size); - if (frv_pltrel_section (info)->contents == NULL) + frvfdpic_pltrel_section (info) + ->_raw_size); + if (frvfdpic_pltrel_section (info)->contents == NULL) return FALSE; } } /* Add 4 bytes for every block of at most 65535 lazy PLT entries, such that there's room for the additional instruction needed to - call the resolver. Since _frv_assign_got_entries didn't account - for them, our block size is 4 bytes smaller than the real block - size. */ + call the resolver. Since _frvfdpic_assign_got_entries didn't + account for them, our block size is 4 bytes smaller than the real + block size. */ if (elf_hash_table (info)->dynamic_sections_created) { - frv_plt_section (info)->_raw_size = gpinfo.g.lzplt - + ((gpinfo.g.lzplt + (FRV_LZPLT_BLOCK_SIZE - 4) - 8) - / (FRV_LZPLT_BLOCK_SIZE - 4) * 4); + frvfdpic_plt_section (info)->_raw_size = gpinfo.g.lzplt + + ((gpinfo.g.lzplt + (FRVFDPIC_LZPLT_BLOCK_SIZE - 4) - 8) + / (FRVFDPIC_LZPLT_BLOCK_SIZE - 4) * 4); } - /* Reset it, such that _frv_assign_plt_entries() can use it to + /* Reset it, such that _frvfdpic_assign_plt_entries() can use it to actually assign lazy PLT entries addresses. */ gpinfo.g.lzplt = 0; /* Save information that we're going to need to generate GOT and PLT entries. */ - frv_got_initial_offset (info) = -gpinfo.gothilo.min; + frvfdpic_got_initial_offset (info) = -gpinfo.gothilo.min; if (get_elf_backend_data (output_bfd)->want_got_sym) elf_hash_table (info)->hgot->root.u.def.value - += frv_got_initial_offset (info); + += frvfdpic_got_initial_offset (info); if (elf_hash_table (info)->dynamic_sections_created) - frv_plt_initial_offset (info) = frv_plt_section (info)->_raw_size; + frvfdpic_plt_initial_offset (info) = + frvfdpic_plt_section (info)->_raw_size; - htab_traverse (frv_relocs_info (info), _frv_assign_plt_entries, &gpinfo); + htab_traverse (frvfdpic_relocs_info (info), _frvfdpic_assign_plt_entries, + &gpinfo); /* Allocate the PLT section contents only after - _frv_assign_plt_entries has a chance to add the size of the + _frvfdpic_assign_plt_entries has a chance to add the size of the non-lazy PLT entries. */ if (elf_hash_table (info)->dynamic_sections_created) { - if (frv_plt_section (info)->_raw_size == 0) - frv_plt_section (info)->flags |= SEC_EXCLUDE; + if (frvfdpic_plt_section (info)->_raw_size == 0) + frvfdpic_plt_section (info)->flags |= SEC_EXCLUDE; else { - frv_plt_section (info)->contents = - (bfd_byte *) bfd_zalloc (dynobj, frv_plt_section (info)->_raw_size); - if (frv_plt_section (info)->contents == NULL) + frvfdpic_plt_section (info)->contents = + (bfd_byte *) bfd_zalloc (dynobj, + frvfdpic_plt_section (info)->_raw_size); + if (frvfdpic_plt_section (info)->contents == NULL) return FALSE; } } if (elf_hash_table (info)->dynamic_sections_created) { - if (frv_got_section (info)->_raw_size) + if (frvfdpic_got_section (info)->_raw_size) if (!_bfd_elf_add_dynamic_entry (info, DT_PLTGOT, 0)) return FALSE; - if (frv_pltrel_section (info)->_raw_size) + if (frvfdpic_pltrel_section (info)->_raw_size) if (!_bfd_elf_add_dynamic_entry (info, DT_PLTRELSZ, 0) || !_bfd_elf_add_dynamic_entry (info, DT_PLTREL, DT_REL) || !_bfd_elf_add_dynamic_entry (info, DT_JMPREL, 0)) return FALSE; - if (frv_gotrel_section (info)->_raw_size) + if (frvfdpic_gotrel_section (info)->_raw_size) if (!_bfd_elf_add_dynamic_entry (info, DT_REL, 0) || !_bfd_elf_add_dynamic_entry (info, DT_RELSZ, 0) || !_bfd_elf_add_dynamic_entry (info, DT_RELENT, @@ -3557,11 +3636,10 @@ elf32_frv_size_dynamic_sections (bfd *output_bfd, } static bfd_boolean -elf32_frv_always_size_sections (bfd *output_bfd, - struct bfd_link_info *info) +elf32_frvfdpic_always_size_sections (bfd *output_bfd, + struct bfd_link_info *info) { - if (!info->relocatable - && elf_elfheader (output_bfd)->e_flags & EF_FRV_FDPIC) + if (!info->relocatable) { struct elf_link_hash_entry *h; asection *sec; @@ -3603,45 +3681,42 @@ elf32_frv_always_size_sections (bfd *output_bfd, } static bfd_boolean -elf32_frv_modify_segment_map (bfd *output_bfd, - struct bfd_link_info *info) +elf32_frvfdpic_modify_segment_map (bfd *output_bfd, + struct bfd_link_info *info) { - if (elf_elfheader (output_bfd)->e_flags & EF_FRV_FDPIC) - { - struct elf_segment_map *m; + struct elf_segment_map *m; - for (m = elf_tdata (output_bfd)->segment_map; m != NULL; m = m->next) - if (m->p_type == PT_GNU_STACK) - break; + for (m = elf_tdata (output_bfd)->segment_map; m != NULL; m = m->next) + if (m->p_type == PT_GNU_STACK) + break; + + if (m) + { + asection *sec = bfd_get_section_by_name (output_bfd, ".stack"); + struct elf_link_hash_entry *h; - if (m) + if (sec) { - asection *sec = bfd_get_section_by_name (output_bfd, ".stack"); - struct elf_link_hash_entry *h; + /* Obtain the pointer to the __stacksize symbol. */ + h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize", + FALSE, FALSE, FALSE); + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *)h->root.u.i.link; + BFD_ASSERT (h->root.type == bfd_link_hash_defined); - if (sec) - { - /* Obtain the pointer to the __stacksize symbol. */ - h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize", - FALSE, FALSE, FALSE); - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *)h->root.u.i.link; - BFD_ASSERT (h->root.type == bfd_link_hash_defined); - - /* Set the section size from the symbol value. We - intentionally ignore the symbol section. */ - if (h->root.type == bfd_link_hash_defined) - sec->_raw_size = h->root.u.def.value; - else - sec->_raw_size = DEFAULT_STACK_SIZE; + /* Set the section size from the symbol value. We + intentionally ignore the symbol section. */ + if (h->root.type == bfd_link_hash_defined) + sec->_raw_size = h->root.u.def.value; + else + sec->_raw_size = DEFAULT_STACK_SIZE; - /* Add the stack section to the PT_GNU_STACK segment, - such that its size and alignment requirements make it - to the segment. */ - m->sections[m->count] = sec; - m->count++; - } + /* Add the stack section to the PT_GNU_STACK segment, + such that its size and alignment requirements make it + to the segment. */ + m->sections[m->count] = sec; + m->count++; } } @@ -3651,60 +3726,51 @@ elf32_frv_modify_segment_map (bfd *output_bfd, /* Fill in code and data in dynamic sections. */ static bfd_boolean -elf32_frv_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info) +elf32_frv_finish_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) +{ + /* Nothing to be done for non-FDPIC. */ + return TRUE; +} + +static bfd_boolean +elf32_frvfdpic_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) { bfd *dynobj; asection *sdyn; dynobj = elf_hash_table (info)->dynobj; - if (frv_got_section (info)) + if (frvfdpic_got_section (info)) { - BFD_ASSERT (frv_gotrel_section (info)->_raw_size - == (frv_gotrel_section (info)->reloc_count + BFD_ASSERT (frvfdpic_gotrel_section (info)->_raw_size + == (frvfdpic_gotrel_section (info)->reloc_count * sizeof (Elf32_External_Rel))); - if (frv_gotfixup_section (info)) + if (frvfdpic_gotfixup_section (info)) { - if (elf_elfheader (output_bfd)->e_flags & EF_FRV_FDPIC) - { - struct elf_link_hash_entry *hgot = elf_hash_table (info)->hgot; - bfd_vma got_value = hgot->root.u.def.value - + hgot->root.u.def.section->output_section->vma - + hgot->root.u.def.section->output_offset; + struct elf_link_hash_entry *hgot = elf_hash_table (info)->hgot; + bfd_vma got_value = hgot->root.u.def.value + + hgot->root.u.def.section->output_section->vma + + hgot->root.u.def.section->output_offset; - _frv_add_rofixup (output_bfd, frv_gotfixup_section (info), - got_value, 0); - } + _frvfdpic_add_rofixup (output_bfd, frvfdpic_gotfixup_section (info), + got_value, 0); - if (frv_gotfixup_section (info)->_raw_size - != (frv_gotfixup_section (info)->reloc_count * 4)) + if (frvfdpic_gotfixup_section (info)->_raw_size + != (frvfdpic_gotfixup_section (info)->reloc_count * 4)) { - if (frv_gotfixup_section (info)->_raw_size - < frv_gotfixup_section (info)->reloc_count * 4) - { - info->callbacks->warning - (info, "LINKER BUG: .rofixup section size mismatch", - ".rofixup", NULL, NULL, 0); - abort (); - return FALSE; - } - else if (!elf_hash_table (info)->dynamic_sections_created) - { - info->callbacks->warning - (info, "no dynamic sections, missing -melf32frvfd?", - ".rofixup", NULL, NULL, 0); - return FALSE; - } - BFD_ASSERT (0); + (*_bfd_error_handler) + ("LINKER BUG: .rofixup section size mismatch"); + return FALSE; } } } if (elf_hash_table (info)->dynamic_sections_created) { - BFD_ASSERT (frv_pltrel_section (info)->_raw_size - == (frv_pltrel_section (info)->reloc_count + BFD_ASSERT (frvfdpic_pltrel_section (info)->_raw_size + == (frvfdpic_pltrel_section (info)->reloc_count * sizeof (Elf32_External_Rel))); } @@ -3732,23 +3798,24 @@ elf32_frv_finish_dynamic_sections (bfd *output_bfd, break; case DT_PLTGOT: - dyn.d_un.d_ptr = frv_got_section (info)->output_section->vma - + frv_got_section (info)->output_offset - + frv_got_initial_offset (info); + dyn.d_un.d_ptr = frvfdpic_got_section (info)->output_section->vma + + frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info); bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; case DT_JMPREL: - dyn.d_un.d_ptr = frv_pltrel_section (info)->output_section->vma - + frv_pltrel_section (info)->output_offset; + dyn.d_un.d_ptr = frvfdpic_pltrel_section (info) + ->output_section->vma + + frvfdpic_pltrel_section (info)->output_offset; bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; case DT_PLTRELSZ: - if (frv_pltrel_section (info)->_cooked_size != 0) - dyn.d_un.d_val = frv_pltrel_section (info)->_cooked_size; + if (frvfdpic_pltrel_section (info)->_cooked_size != 0) + dyn.d_un.d_val = frvfdpic_pltrel_section (info)->_cooked_size; else - dyn.d_un.d_val = frv_pltrel_section (info)->_raw_size; + dyn.d_un.d_val = frvfdpic_pltrel_section (info)->_raw_size; bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; } @@ -3762,8 +3829,9 @@ elf32_frv_finish_dynamic_sections (bfd *output_bfd, regular object. */ static bfd_boolean -elf32_frv_adjust_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED, - struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) +elf32_frvfdpic_adjust_dynamic_symbol +(struct bfd_link_info *info ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) { bfd * dynobj; @@ -3796,10 +3864,11 @@ elf32_frv_adjust_dynamic_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED, /* Perform any actions needed for dynamic symbols. */ static bfd_boolean -elf32_frv_finish_dynamic_symbol (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED, - struct elf_link_hash_entry *h ATTRIBUTE_UNUSED, - Elf_Internal_Sym *sym ATTRIBUTE_UNUSED) +elf32_frvfdpic_finish_dynamic_symbol +(bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED, + Elf_Internal_Sym *sym ATTRIBUTE_UNUSED) { return TRUE; } @@ -3808,44 +3877,37 @@ elf32_frv_finish_dynamic_symbol (bfd *output_bfd ATTRIBUTE_UNUSED, shared libraries into pcrel within the given input section. */ static bfd_boolean -frv_elf_use_relative_eh_frame (bfd *input_bfd, - struct bfd_link_info *info ATTRIBUTE_UNUSED, - asection *eh_frame_section ATTRIBUTE_UNUSED) +frvfdpic_elf_use_relative_eh_frame +(bfd *input_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *eh_frame_section ATTRIBUTE_UNUSED) { /* We can't use PC-relative encodings in FDPIC binaries, in general. */ - if (elf_elfheader (input_bfd)->e_flags & EF_FRV_FDPIC) - return FALSE; - - return TRUE; + return FALSE; } /* Adjust the contents of an eh_frame_hdr section before they're output. */ static bfd_byte -frv_elf_encode_eh_address (bfd *abfd, - struct bfd_link_info *info, - asection *osec, bfd_vma offset, - asection *loc_sec, bfd_vma loc_offset, - bfd_vma *encoded) +frvfdpic_elf_encode_eh_address (bfd *abfd, + struct bfd_link_info *info, + asection *osec, bfd_vma offset, + asection *loc_sec, bfd_vma loc_offset, + bfd_vma *encoded) { struct elf_link_hash_entry *h; - /* Non-FDPIC binaries can use PC-relative encodings. */ - if (! (elf_elfheader (abfd)->e_flags & EF_FRV_FDPIC)) - return _bfd_elf_encode_eh_address (abfd, info, osec, offset, - loc_sec, loc_offset, encoded); - h = elf_hash_table (info)->hgot; BFD_ASSERT (h && h->root.type == bfd_link_hash_defined); - if (! h || (_frv_osec_to_segment (abfd, osec) - == _frv_osec_to_segment (abfd, loc_sec->output_section))) + if (! h || (_frvfdpic_osec_to_segment (abfd, osec) + == _frvfdpic_osec_to_segment (abfd, loc_sec->output_section))) return _bfd_elf_encode_eh_address (abfd, info, osec, offset, loc_sec, loc_offset, encoded); - BFD_ASSERT (_frv_osec_to_segment (abfd, osec) - == _frv_osec_to_segment (abfd, - h->root.u.def.section->output_section)); + BFD_ASSERT (_frvfdpic_osec_to_segment (abfd, osec) + == (_frvfdpic_osec_to_segment + (abfd, h->root.u.def.section->output_section))); *encoded = osec->vma + offset - (h->root.u.def.value @@ -3971,7 +4033,7 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; bfd *dynobj; - struct frv_pic_relocs_info *picrel; + struct frvfdpic_relocs_info *picrel; if (info->relocatable) return TRUE; @@ -3997,8 +4059,6 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) switch (ELF32_R_TYPE (rel->r_info)) { - case R_FRV_LABEL24: - case R_FRV_32: case R_FRV_GOT12: case R_FRV_GOTHI: case R_FRV_GOTLO: @@ -4013,12 +4073,26 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) case R_FRV_FUNCDESC_GOTOFFLO: case R_FRV_FUNCDESC: case R_FRV_FUNCDESC_VALUE: + if (! IS_FDPIC (abfd)) + goto bad_reloc; + /* Fall through. */ + case R_FRV_GPREL12: + case R_FRV_GPRELU12: + case R_FRV_GPRELHI: + case R_FRV_GPRELLO: + case R_FRV_LABEL24: + case R_FRV_32: if (! dynobj) { elf_hash_table (info)->dynobj = dynobj = abfd; if (! _frv_create_got_section (abfd, info)) return FALSE; } + if (! IS_FDPIC (abfd)) + { + picrel = NULL; + break; + } if (h != NULL) { if (h->dynindx == -1) @@ -4032,14 +4106,14 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) break; } picrel - = frv_pic_relocs_info_for_global (frv_relocs_info (info), - abfd, h, - rel->r_addend, INSERT); + = frvfdpic_relocs_info_for_global (frvfdpic_relocs_info (info), + abfd, h, + rel->r_addend, INSERT); } else - picrel = frv_pic_relocs_info_for_local (frv_relocs_info (info), - abfd, r_symndx, - rel->r_addend, INSERT); + picrel = frvfdpic_relocs_info_for_local (frvfdpic_relocs_info + (info), abfd, r_symndx, + rel->r_addend, INSERT); if (! picrel) return FALSE; break; @@ -4052,7 +4126,8 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) switch (ELF32_R_TYPE (rel->r_info)) { case R_FRV_LABEL24: - picrel->call = 1; + if (IS_FDPIC (abfd)) + picrel->call = 1; break; case R_FRV_FUNCDESC_VALUE: @@ -4060,7 +4135,11 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) picrel->relocs32--; /* Fall through. */ + case R_FRV_32: + if (! IS_FDPIC (abfd)) + break; + picrel->sym = 1; if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) picrel->relocs32++; @@ -4117,6 +4196,23 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) return FALSE; break; + + case R_FRV_LABEL16: + case R_FRV_LO16: + case R_FRV_HI16: + case R_FRV_GPREL12: + case R_FRV_GPRELU12: + case R_FRV_GPREL32: + case R_FRV_GPRELHI: + case R_FRV_GPRELLO: + break; + + default: + bad_reloc: + (*_bfd_error_handler) + (_("%s: unsupported relocation type %i"), + bfd_archive_filename (abfd), ELF32_R_TYPE (rel->r_info)); + return FALSE; } } @@ -4153,7 +4249,8 @@ elf32_frv_object_p (abfd) bfd *abfd; { bfd_default_set_arch_mach (abfd, bfd_arch_frv, elf32_frv_machine (abfd)); - return TRUE; + return (((elf_elfheader (abfd)->e_flags & EF_FRV_FDPIC) != 0) + == (IS_FDPIC (abfd))); } /* Function to set the ELF flag bits. */ @@ -4467,6 +4564,20 @@ frv_elf_merge_private_bfd_data (ibfd, obfd) if (old_partial != (old_flags & EF_FRV_CPU_MASK)) bfd_default_set_arch_mach (obfd, bfd_arch_frv, elf32_frv_machine (obfd)); + if (((new_flags & EF_FRV_FDPIC) == 0) + != (! IS_FDPIC (ibfd))) + { + error = TRUE; + if (IS_FDPIC (obfd)) + (*_bfd_error_handler) + (_("%s: cannot link non-fdpic object file into fdpic executable"), + bfd_get_filename (ibfd)); + else + (*_bfd_error_handler) + (_("%s: cannot link fdpic object file into non-fdpic executable"), + bfd_get_filename (ibfd)); + } + if (error) bfd_set_error (bfd_error_bad_value); @@ -4564,7 +4675,6 @@ frv_elf_print_private_bfd_data (abfd, ptr) #define TARGET_BIG_SYM bfd_elf32_frv_vec #define TARGET_BIG_NAME "elf32-frv" -#define elf_info_to_howto_rel frv_info_to_howto_rel #define elf_info_to_howto frv_info_to_howto_rela #define elf_backend_relocate_section elf32_frv_relocate_section #define elf_backend_gc_mark_hook elf32_frv_gc_mark_hook @@ -4582,39 +4692,73 @@ frv_elf_print_private_bfd_data (abfd, ptr) #define bfd_elf32_bfd_merge_private_bfd_data frv_elf_merge_private_bfd_data #define bfd_elf32_bfd_print_private_bfd_data frv_elf_print_private_bfd_data -#define bfd_elf32_bfd_link_hash_table_create frv_elf_link_hash_table_create +#define elf_backend_want_got_sym 1 +#define elf_backend_got_header_size 0 +#define elf_backend_want_got_plt 0 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_plt_header_size 0 + +#define elf_backend_finish_dynamic_sections \ + elf32_frv_finish_dynamic_sections + +#include "elf32-target.h" + +#undef ELF_MAXPAGESIZE +#define ELF_MAXPAGESIZE 0x4000 + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_frvfdpic_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-frvfdpic" +#undef elf32_bed +#define elf32_bed elf32_frvfdpic_bed + +#undef elf_info_to_howto_rel +#define elf_info_to_howto_rel frvfdpic_info_to_howto_rel + +#undef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create \ + frvfdpic_elf_link_hash_table_create +#undef elf_backend_always_size_sections #define elf_backend_always_size_sections \ - elf32_frv_always_size_sections + elf32_frvfdpic_always_size_sections +#undef elf_backend_modify_segment_map #define elf_backend_modify_segment_map \ - elf32_frv_modify_segment_map + elf32_frvfdpic_modify_segment_map +#undef elf_backend_create_dynamic_sections #define elf_backend_create_dynamic_sections \ - elf32_frv_create_dynamic_sections + elf32_frvfdpic_create_dynamic_sections +#undef elf_backend_adjust_dynamic_symbol #define elf_backend_adjust_dynamic_symbol \ - elf32_frv_adjust_dynamic_symbol + elf32_frvfdpic_adjust_dynamic_symbol +#undef elf_backend_size_dynamic_sections #define elf_backend_size_dynamic_sections \ - elf32_frv_size_dynamic_sections + elf32_frvfdpic_size_dynamic_sections +#undef elf_backend_finish_dynamic_symbol #define elf_backend_finish_dynamic_symbol \ - elf32_frv_finish_dynamic_symbol + elf32_frvfdpic_finish_dynamic_symbol +#undef elf_backend_finish_dynamic_sections #define elf_backend_finish_dynamic_sections \ - elf32_frv_finish_dynamic_sections - -#define elf_backend_want_got_sym 1 -#define elf_backend_got_header_size 0 -#define elf_backend_want_got_plt 0 -#define elf_backend_plt_readonly 1 -#define elf_backend_want_plt_sym 0 -#define elf_backend_plt_header_size 0 + elf32_frvfdpic_finish_dynamic_sections +#undef elf_backend_can_make_relative_eh_frame #define elf_backend_can_make_relative_eh_frame \ - frv_elf_use_relative_eh_frame + frvfdpic_elf_use_relative_eh_frame +#undef elf_backend_can_make_lsda_relative_eh_frame #define elf_backend_can_make_lsda_relative_eh_frame \ - frv_elf_use_relative_eh_frame -#define elf_backend_encode_eh_address frv_elf_encode_eh_address + frvfdpic_elf_use_relative_eh_frame +#undef elf_backend_encode_eh_address +#define elf_backend_encode_eh_address \ + frvfdpic_elf_encode_eh_address +#undef elf_backend_may_use_rel_p #define elf_backend_may_use_rel_p 1 +#undef elf_backend_may_use_rela_p #define elf_backend_may_use_rela_p 1 /* We use REL for dynamic relocations only. */ +#undef elf_backend_default_use_rela_p #define elf_backend_default_use_rela_p 1 #include "elf32-target.h" diff --git a/bfd/targets.c b/bfd/targets.c index 29e3f626a..ad6362abf 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -532,6 +532,7 @@ extern const bfd_target bfd_elf32_d30v_vec; extern const bfd_target bfd_elf32_dlx_big_vec; extern const bfd_target bfd_elf32_fr30_vec; extern const bfd_target bfd_elf32_frv_vec; +extern const bfd_target bfd_elf32_frvfdpic_vec; extern const bfd_target bfd_elf32_h8300_vec; extern const bfd_target bfd_elf32_hppa_linux_vec; extern const bfd_target bfd_elf32_hppa_vec; @@ -823,6 +824,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_dlx_big_vec, &bfd_elf32_fr30_vec, &bfd_elf32_frv_vec, + &bfd_elf32_frvfdpic_vec, &bfd_elf32_h8300_vec, &bfd_elf32_hppa_linux_vec, &bfd_elf32_hppa_vec, -- 2.11.4.GIT