This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Wednesday 18 October 2006 10:26, Nick Clifton wrote: > > - if (strcmp (*l, "elf64-sparc") == 0) > > + if (strncmp (*l, "elf64-sparc", 11) == 0) > > We now have the funky CONST_STRNEQ macro (defined in bfd-in.h) for > performing a strncmp against a constant string without having to count > exactly how many characters it contains. thanks for the tip ... ive check in the updated attached patch side note, useful to update tc-i386.c with the CONST_STRNEQ changes as well ? -mike
Attachment:
pgp00000.pgp
Description: PGP signature
2006-10-17 Roy Marples <uberlord@gentoo.org> * bfd/elf64-sparc.c: Add FreeBSD support. (elf64_sparc_fbsd_post_process_headers): New function. * bfd/targets.c (_bfd_target_vector): Add bfd_elf64_sparc_freebsd_vec. * bfd/config.bfd (sparc64-*-freebsd*): Set targ_defvec to bfd_elf64_sparc_freebsd_vec. * bfd/configure.in: Add entry for bfd_elf64_sparc_freebsd_vec. * bfd/configure: Regenerate. * gas/config/tc-sparc.c (md_parse_option): Treat any target starting with elf32-sparc as a viable target for the -32 switch and any target starting with elf64-sparc as a viable target for the -64 switch. (sparc_target_format): For 64-bit ELF flavoured output use ELF_TARGET_FORMAT64 while for 32-bit ELF flavoured output use ELF_TARGET_FORMAT. * gas/config/tc-sparc.h (ELF_TARGET_FORMAT, ELF_TARGET_FORMAT64): Define. * ld/emulparams/elf64_sparc_fbsd.sh (OUTPUT_FORMAT): Define as elf64-sparc-freebsd. --- bfd/elf64-sparc.c +++ bfd/elf64-sparc.c @@ -902,3 +902,33 @@ const struct elf_size_info elf64_sparc_s #define elf_backend_plt_alignment 8 #include "elf64-target.h" + +/* FreeBSD support */ +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf64_sparc_freebsd_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf64-sparc-freebsd" + +/* The kernel recognizes executables as valid only if they carry a + "FreeBSD" label in the ELF header. So we put this label on all + executables and (for simplicity) also all other object files. */ + +static void +elf64_sparc_fbsd_post_process_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) +{ + Elf_Internal_Ehdr *i_ehdrp; /* ELF file header, internal form. */ + + i_ehdrp = elf_elfheader (abfd); + + /* Put an ABI label supported by FreeBSD >= 4.1 */ + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; +} + +#undef elf_backend_post_process_headers +#define elf_backend_post_process_headers elf64_sparc_fbsd_post_process_headers +#undef elf64_bed +#define elf64_bed elf64_sparc_fbsd_bed + +#include "elf64-target.h" + --- bfd/targets.c +++ bfd/targets.c @@ -674,6 +674,7 @@ extern const bfd_target bfd_elf64_sh64bl extern const bfd_target bfd_elf64_sh64lnbsd_vec; extern const bfd_target bfd_elf64_sh64nbsd_vec; extern const bfd_target bfd_elf64_sparc_vec; +extern const bfd_target bfd_elf64_sparc_freebsd_vec; extern const bfd_target bfd_elf64_tradbigmips_vec; extern const bfd_target bfd_elf64_tradlittlemips_vec; extern const bfd_target bfd_elf64_x86_64_freebsd_vec; @@ -1002,6 +1003,7 @@ static const bfd_target * const _bfd_tar &bfd_elf64_sh64lin_vec, &bfd_elf64_sh64blin_vec, &bfd_elf64_sparc_vec, + &bfd_elf64_sparc_freebsd_vec, &bfd_elf64_tradbigmips_vec, &bfd_elf64_tradlittlemips_vec, &bfd_elf64_x86_64_freebsd_vec, --- bfd/config.bfd +++ bfd/config.bfd @@ -182,7 +182,11 @@ case "${targ}" in targ_selvecs="bfd_elf64_ia64_hpux_big_vec" want64=true ;; - sparc64-*-freebsd* | sparc64-*-netbsd* | sparc64-*-openbsd* | sparc64-*-kfreebsd*-gnu) + sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu) + targ_defvec=bfd_elf64_sparc_freebsd_vec + targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" + ;; + sparc64-*-netbsd* | sparc64-*-openbsd*) targ_defvec=bfd_elf64_sparc_vec targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" want64=true --- bfd/configure.in +++ bfd/configure.in @@ -716,6 +716,7 @@ do bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_sparc_freebsd_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; --- bfd/configure +++ bfd/configure @@ -716,6 +716,7 @@ do bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_sparc_freebsd_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; --- gas/config/tc-sparc.c +++ gas/config/tc-sparc.c @@ -337,7 +337,7 @@ sparc_target_format () #endif #ifdef OBJ_ELF - return sparc_arch_size == 64 ? "elf64-sparc" : "elf32-sparc"; + return sparc_arch_size == 64 ? ELF64_TARGET_FORMAT : ELF_TARGET_FORMAT; #endif abort (); @@ -545,12 +545,12 @@ md_parse_option (c, arg) { if (sparc_arch_size == 32) { - if (strcmp (*l, "elf32-sparc") == 0) + if (CONST_STRNEQ (*l, "elf32-sparc")) break; } else { - if (strcmp (*l, "elf64-sparc") == 0) + if (CONST_STRNEQ (*l, "elf64-sparc")) break; } } --- gas/config/tc-sparc.h +++ gas/config/tc-sparc.h @@ -31,6 +31,19 @@ struct frag; #define TARGET_ARCH bfd_arch_sparc +#ifdef TE_FreeBSD +#define ELF_TARGET_FORMAT "elf32-sparc-freebsd" +#define ELF64_TARGET_FORMAT "elf64-sparc-freebsd" +#endif + +#ifndef ELF_TARGET_FORMAT +#define ELF_TARGET_FORMAT "elf32-sparc" +#endif + +#ifndef ELF64_TARGET_FORMAT +#define ELF64_TARGET_FORMAT "elf64-sparc" +#endif + extern const char *sparc_target_format PARAMS ((void)); #define TARGET_FORMAT sparc_target_format () --- ld/emulparams/elf64_sparc_fbsd.sh +++ ld/emulparams/elf64_sparc_fbsd.sh @@ -1,2 +1,4 @@ . ${srcdir}/emulparams/elf64_sparc.sh . ${srcdir}/emulparams/elf_fbsd.sh + +OUTPUT_FORMAT="elf64-sparc-freebsd"
--- gas/config/tc-i386.c +++ gas/config/tc-i386.c @@ -5882,7 +5882,7 @@ md_parse_option (int c, char *arg) list = bfd_target_list (); for (l = list; *l != NULL; l++) - if ( strncmp (*l, "elf64-x86-64", 12) == 0 + if (CONST_STRNEQ (*l, "elf64-x86-64") || strcmp (*l, "coff-x86-64") == 0 || strcmp (*l, "pe-x86-64") == 0 || strcmp (*l, "pei-x86-64") == 0) @@ -7785,7 +7785,7 @@ x86_64_section_letter (int letter, char int x86_64_section_word (char *str, size_t len) { - if (len == 5 && flag_code == CODE_64BIT && strncmp (str, "large", 5) == 0) + if (len == 5 && flag_code == CODE_64BIT && CONST_STRNEQ (str, "large") == 0) return SHF_X86_64_LARGE; return -1;
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |