Hello Maintainers, Here is a patch to add target Score to GNU Binutils. I volunteer to become the Score port maintainer. ChangeLog: 1. GAS part 1.1 binutils-2.16.1/config.sub score|score-*) basic_machine=score-linux os=-elf ;; 1.2 add files to binutils-2.16.1/gas/config tc-score.c tc-score.h score-datadep.h score-inst.h 1.3 gas/Makefile.in 1.3.1 CPU_TYPES = score \ 1.3.2 TARGET_CPU_CFILES = config/tc-score.c \ 1.3.3 TARGET_CPU_HFILES = config/tc-score.h \ 1.3.4 DEPTC_score_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-score.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/elf/score.h $(INCDIR)/elf/reloc-macros.h \ dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(srcdir)/config/score-inst.h $(srcdir)/config/score-datadep.h 1.4 gas/configure.tgt 1.4.1 score*) cpu_type=score endian=big ;; score*l) cpu_type=score endian=little ;; 1.4.2 score-*-elf) fmt=elf bfd_gas=yes ;; 2. BFD part 2.1 2.1.1 add files to binutils-2.16.1/bfd elf32-score.c cpu-score.c 2.1.2 add files to binutils-2.16.1/include/elf score.h 2.2 bfd/configure bfd_elf32_bigscore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;; bfd_elf32_littlescore_vec) tb="$tb elf32-score.lo elf32.lo $elf" ;; 2.3 bfd/Makefile.in 2.3.1 ALL_MACHINES = cpu-score.lo \ 2.3.2 ALL_MACHINES_CFILES = cpu-score.c \ 2.3.3 BFD32_BACKENDS = elf32-score.lo \ 2.3.4 BFD32_BACKENDS_CFILES = elf32-score.c \ 2.3.5 SOURCE_HFILES = elf32-score.h 2.3.6 cpu-score.lo: cpu-score.c $(INCDIR)/filenames.h 2.3.7 elf32-score.lo: elf32-score.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/score.h $(INCDIR)/elf/reloc-macros.h \ elf32-score.h elf32-target.h 2.4 bfd/config.bfd score*-*-elf*) targ_defvec=bfd_elf32_bigscore_vec targ_selvecs=bfd_elf32_littlescore_vec ;; 2.5 bfd/targets.c 2.5.1 extern const bfd_target bfd_elf32_bigscore_vec; 2.5.2 extern const bfd_target bfd_elf32_littlescore_vec; 2.5.3 &bfd_elf32_bigscore_vec, 2.5.4 &bfd_elf32_littlescore_vec, 2.6 bfd/archures.c 2.6.1 . bfd_arch_score, {* Sunplus score *} 2.6.2 extern const bfd_arch_info_type bfd_score_arch; 2.6.3 static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_score_arch, 2.7 bfd/bfd-in2.h /* Score relocations. */ /* low 16 bit for ldst. */ BFD_RELOC_SCORE_DUMMY1, BFD_RELOC_GPREL15, BFD_RELOC_SCORE_DUMMY2, /* This is a 24-bit reloc with the right 1 bits assumed to be 0. */ BFD_RELOC_SCORE_JMP, /* This is a 19-bit reloc with the right 1 bits assumed to be 0. */ BFD_RELOC_SCORE_BRANCH, /* This is a 11-bit reloc with the right 1 bits assumed to be 0. */ BFD_RELOC_SCORE16_JMP, /* This is a 8-bit reloc with the right 1 bits assumed to be 0. */ BFD_RELOC_SCORE16_BRANCH, 2.8 binutils-2.16.1/include/elf/common.h #define EM_SCORE 135 /* Sunplus Score */ 3. LD part 3.1 add files to binutils-2.16.1/ld/emultempl scoreelf.em add files to binutils-2.16.1/ld/emulparams scoreelf.sh 3.2 ld/configure.tgt score-*-elf) targ_emul=scoreelf ;; 3.3 ld/Makefile.in 3.3.1 ALL_EMULATIONS = escoreelf.o \ 3.3.2 escoreelf.c: $(srcdir)/emulparams/scoreelf.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/scoreelf.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} scoreelf "$(tdir_scoreelf)" 4. Opcodes part 4.1 add files to binutils-2.16.1/opcodes score-dis.c score-opc.h 4.2 opcodes/configure bfd_score_arch) ta="$ta score-dis.lo" ;; 4.3 opcodes/Makefile.in 4.3.1 HFILES = score-opc.h \ 4.3.2 CFILES = score-dis.c \ 4.3.3 ALL_MACHINES = score-dis.lo \ 4.3.4 score-dis.lo: score-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h score-opc.h \ $(INCDIR)/bfdlink.h opintl.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/score.h \ $(INCDIR)/elf/reloc-macros.h 4.4 opcodes/disassemble.c 4.4.1 #define ARCH_score 4.4.2 #ifdef ARCH_score case bfd_arch_score: if (bfd_big_endian (abfd)) disassemble = print_insn_big_score; else disassemble = print_insn_little_score; break; #endif 4.5 include/dis-asm.h extern int print_insn_big_score (bfd_vma, disassemble_info *); extern int print_insn_little_score (bfd_vma, disassemble_info *); 5. Binutils part 5.1 binutils/Makefile.in readelf.o : $(INCDIR)/elf/score.h 5.2 binutils/readelf.c add score specific code 6. Testsuite part 6.1 gas/testsuite/gas/elf/elf.exp 加上如下代码 if {[istarget "score-*-*"]} then { set target_machine -score } 并且在 gas/testsuite/gas/elf/ 下添加文件 section2.e-score 6.2 ld/testsuite/ld-srec/srec.exp 在两个地方加上 setup_xfail "score-*-*" 6.3 ld/testsuite/ld-elf/merge.d 加上 "score-*-*" 6.4 ld/testsuite/ld-elfcomm/elfcomm.exp 加上如下代码 if { [istarget score-*-*] } { untested $test1w1 untested $test1w2 untested $test1c1 untested $test1c2 return } Best regards Ligang