diff --git a/gas/ChangeLog b/gas/ChangeLog index f9227da54d..6e7dc19375 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,18 @@ +2004-05-05 Alexandre Oliva + + * configure.in: Set em=linux for frv-*-*linux*. + * configure: Rebuilt. + * config/tc-frv.h (TARGET_FORMAT): Use elf32-frvfdpic if... + (frv_md_fdpic_enabled): New. + * config/tc-frv.c (frv_md_fdpic_enabled): New. + (DEFAULT_FDPIC): New. + (frv_flags): Use DEFAULT_FDPIC. + (frv_pic_flag): Likewise. + (OPTION_NOPIC): New. + (md_longopts): Add -mnopic. + (md_parse_option): Handle it. + (md_show_usage): Add -mfdpic and -mnopic. + 2004-05-05 Peter Barada * config/tc-m68k.c: Add find_cf_chip to print list of valid diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c index 6c6528bfb8..e85db95af2 100644 --- a/gas/config/tc-frv.c +++ b/gas/config/tc-frv.c @@ -162,15 +162,21 @@ static FRV_VLIW vliw; #endif #endif +#ifdef TE_LINUX +# define DEFAULT_FDPIC EF_FRV_FDPIC +#else +# define DEFAULT_FDPIC 0 +#endif + static unsigned long frv_mach = bfd_mach_frv; static bfd_boolean fr400_audio; /* Flags to set in the elf header */ -static flagword frv_flags = DEFAULT_FLAGS; +static flagword frv_flags = DEFAULT_FLAGS | DEFAULT_FDPIC; static int frv_user_set_flags_p = 0; static int frv_pic_p = 0; -static const char *frv_pic_flag = (const char *)0; +static const char *frv_pic_flag = DEFAULT_FDPIC ? "-mfdpic" : (const char *)0; /* Print tomcat-specific debugging info. */ static int tomcat_debug = 0; @@ -220,6 +226,7 @@ const char * md_shortopts = FRV_SHORTOPTS; #define OPTION_PACK (OPTION_MD_BASE + 19) #define OPTION_NO_PACK (OPTION_MD_BASE + 20) #define OPTION_FDPIC (OPTION_MD_BASE + 21) +#define OPTION_NOPIC (OPTION_MD_BASE + 22) struct option md_longopts[] = { @@ -246,6 +253,7 @@ struct option md_longopts[] = { "mpack", no_argument, NULL, OPTION_PACK }, { "mno-pack", no_argument, NULL, OPTION_NO_PACK }, { "mfdpic", no_argument, NULL, OPTION_FDPIC }, + { "mnopic", no_argument, NULL, OPTION_NOPIC }, { NULL, no_argument, NULL, 0 }, }; @@ -428,6 +436,12 @@ md_parse_option (c, arg) frv_pic_flag = "-mfdpic"; break; + case OPTION_NOPIC: + frv_flags &= ~(EF_FRV_FDPIC | EF_FRV_PIC + | EF_FRV_BIGPIC | EF_FRV_LIBPIC); + frv_pic_flag = 0; + break; + case OPTION_TOMCAT_DEBUG: tomcat_debug = 1; break; @@ -461,6 +475,8 @@ md_show_usage (stream) fprintf (stream, _("-mpic Note small position independent code\n")); fprintf (stream, _("-mPIC Note large position independent code\n")); fprintf (stream, _("-mlibrary-pic Compile library for large position indepedent code\n")); + fprintf (stream, _("-mfdpic Assemble for the FDPIC ABI\n")); + fprintf (stream, _("-mnopic Disable -mpic, -mPIC, -mlibrary-pic and -mfdpic\n")); fprintf (stream, _("-mcpu={fr500|fr550|fr400|fr405|fr450|fr300|frv|simple|tomcat}\n")); fprintf (stream, _(" Record the cpu type\n")); fprintf (stream, _("-mtomcat-stats Print out stats for tomcat workarounds\n")); @@ -496,6 +512,12 @@ md_begin () frv_vliw_reset (& vliw, frv_mach, frv_flags); } +bfd_boolean +frv_md_fdpic_enabled (void) +{ + return (frv_flags & EF_FRV_FDPIC) != 0; +} + int chain_num = 0; struct vliw_insn_list *frv_insert_vliw_insn PARAMS ((bfd_boolean)); diff --git a/gas/config/tc-frv.h b/gas/config/tc-frv.h index d2e185d0a7..8bc3c7c297 100644 --- a/gas/config/tc-frv.h +++ b/gas/config/tc-frv.h @@ -30,7 +30,9 @@ /* The target BFD architecture. */ #define TARGET_ARCH bfd_arch_frv -#define TARGET_FORMAT "elf32-frv" +#define TARGET_FORMAT (frv_md_fdpic_enabled () \ + ? "elf32-frvfdpic" : "elf32-frv") +extern bfd_boolean frv_md_fdpic_enabled (void); #define TARGET_BYTES_BIG_ENDIAN 1 diff --git a/gas/configure b/gas/configure index 1cb9226259..7028326dba 100755 --- a/gas/configure +++ b/gas/configure @@ -3321,6 +3321,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 @@ -3331,9 +3332,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 ) @@ -3401,7 +3403,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 @@ -3792,7 +3794,7 @@ 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 3795 "configure"' > conftest.$ac_ext + echo '#line 3797 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -3847,6 +3849,52 @@ 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 "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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" @@ -4262,6 +4310,7 @@ for this_target in $target $canon_targets ; do dlx-*-*) fmt=elf ;; fr30-*-*) fmt=elf ;; + frv-*-*linux*) fmt=elf em=linux;; frv-*-*) fmt=elf ;; hppa-*-linux*) case ${cpu} in @@ -10210,8 +10259,9 @@ case "${need_libm}" in yes) LIBM= case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32*) +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm + # on darwin the libm is a symbolic link to libSystem.dylib ;; *-ncr-sysv4.3*) echo "$as_me:$LINENO: checking for _mwvalidcheckl in -lmw" >&5 diff --git a/gas/configure.in b/gas/configure.in index 83a5768836..ab3b18a2d0 100644 --- a/gas/configure.in +++ b/gas/configure.in @@ -230,6 +230,7 @@ changequote([,])dnl dlx-*-*) fmt=elf ;; fr30-*-*) fmt=elf ;; + frv-*-*linux*) fmt=elf em=linux;; frv-*-*) fmt=elf ;; hppa-*-linux*) case ${cpu} in