This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] m68000 ELF + two m68k gas fixes
- From: Matt Fredette <fredette at theory dot lcs dot mit dot edu>
- To: binutils at sources dot redhat dot com
- Cc: fredette at netbsd dot org, nickc at cambridge dot redhat dot com
- Date: Tue, 18 Dec 101 12:54:42 -0500 (EST)
- Subject: [PATCH] m68000 ELF + two m68k gas fixes
The following patch adds m68000 ELF identification, and fixes two bugs
in m68k gas: one, that the usage always claims that 68020 is the default
cpu (even when configured otherwise), and two, that unconditional,
absolute jumps with a zero displacement "aim" must also be forcefully
relaxed to word mode.
[ for top-level ChangeLog ]
Tue Dec 18 12:45:08 2001 Matt Fredette <fredette@netbsd.org>
* configure.in: Added an arm for m680[01]0-*-netbsdelf*.
[ for bfd/ChangeLog ]
Tue Dec 18 12:43:42 2001 Matt Fredette <fredette@netbsd.org>
* elf32-m68k.c (elf32_m68k_print_private_bfd_data): Recognize
EF_M68000.
[ for binutils/ChangeLog ]
Tue Dec 18 12:40:17 2001 Matt Fredette <fredette@netbsd.org>
* readelf.c (get_machine_flags): Recognize EF_M68000.
[ for gas/ChangeLog ]
Tue Dec 18 12:33:01 2001 Matt Fredette <fredette@netbsd.org>
* config/tc-m68k.h (md_prepare_relax_scan): Force relaxation
into word mode for zero-displacement unconditional absolute
jumps, too, otherwise they get assembled incorrectly.
* config/tc-m68k.c (md_show_usage): No longer display a
hard-coded "68020" for the default CPU, instead display the
canonical name of the true, configured default CPU.
(m68k_elf_final_processing): Mark objects for sub-68020
CPUs with the new EF_M68000 flag.
[ for include/elf/ChangeLog ]
Tue Dec 18 12:32:02 2001 Matt Fredette <fredette@netbsd.org>
* m68k.h (EF_M68000): Define.
[snip]
Index: configure.in
===================================================================
RCS file: /cvs/src/src/configure.in,v
retrieving revision 1.45
diff -c -r1.45 configure.in
*** configure.in 2001/12/13 23:57:00 1.45
--- configure.in 2001/12/18 17:21:12
***************
*** 814,819 ****
--- 814,820 ----
target_configdirs="${target_configdirs} target-bsp target-cygmon"
fi
;;
+ m680[01]0-*-netbsdelf*) ;;
mn10200-*-*)
noconfigdirs="$noconfigdirs target-libffi"
if [ x${is_cross_compiler} != xno ] ; then
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.33
diff -c -r1.33 elf32-m68k.c
*** elf32-m68k.c 2001/12/17 00:52:35 1.33
--- elf32-m68k.c 2001/12/18 17:21:14
***************
*** 434,439 ****
--- 434,442 ----
if (elf_elfheader (abfd)->e_flags & EF_CPU32)
fprintf (file, _ (" [cpu32]"));
+ if (elf_elfheader (abfd)->e_flags & EF_M68000)
+ fprintf (file, _ (" [m68000]"));
+
fputc ('\n', file);
return true;
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.141
diff -c -r1.141 readelf.c
*** readelf.c 2001/12/18 15:08:05 1.141
--- readelf.c 2001/12/18 17:21:20
***************
*** 1591,1596 ****
--- 1591,1598 ----
case EM_68K:
if (e_flags & EF_CPU32)
strcat (buf, ", cpu32");
+ if (e_flags & EF_M68000)
+ strcat (buf, ", m68000");
break;
case EM_PPC:
Index: gas/config/tc-m68k.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68k.c,v
retrieving revision 1.34
diff -c -r1.34 tc-m68k.c
*** tc-m68k.c 2001/11/16 09:34:28 1.34
--- tc-m68k.c 2001/12/18 17:21:24
***************
*** 6915,6930 ****
md_show_usage (stream)
FILE *stream;
{
fprintf (stream, _("\
680X0 options:\n\
-l use 1 word for refs to undefined symbols [default 2]\n\
-m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060 |\n\
-m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -m68360 | -mcpu32 |\n\
-m5200 | -m5202 | -m5204 | -m5206 | -m5206e | -m5307 | -m5407\n\
! specify variant of 680X0 architecture [default 68020]\n\
-m68881 | -m68882 | -mno-68881 | -mno-68882\n\
target has/lacks floating-point coprocessor\n\
! [default yes for 68020, 68030, and cpu32]\n"));
fprintf (stream, _("\
-m68851 | -mno-68851\n\
target has/lacks memory-management unit coprocessor\n\
--- 6915,6949 ----
md_show_usage (stream)
FILE *stream;
{
+ int i;
+ const char *default_cpu = TARGET_CPU;
+ int default_arch;
+
+ /* Get the canonical name for the default target CPU. */
+ if (*default_cpu == 'm')
+ default_cpu++;
+ for (i = 0; i < n_archs; i++)
+ if (strcasecmp (default_cpu, archs[i].name) == 0) {
+ default_arch = archs[i].arch;
+ for (i = 0; i < n_archs; i++)
+ if (archs[i].arch == default_arch
+ && !archs[i].alias) {
+ default_cpu = archs[i].name;
+ break;
+ }
+ break;
+ }
+
fprintf (stream, _("\
680X0 options:\n\
-l use 1 word for refs to undefined symbols [default 2]\n\
-m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060 |\n\
-m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -m68360 | -mcpu32 |\n\
-m5200 | -m5202 | -m5204 | -m5206 | -m5206e | -m5307 | -m5407\n\
! specify variant of 680X0 architecture [default %s]\n\
-m68881 | -m68882 | -mno-68881 | -mno-68882\n\
target has/lacks floating-point coprocessor\n\
! [default yes for 68020, 68030, and cpu32]\n"), default_cpu);
fprintf (stream, _("\
-m68851 | -mno-68851\n\
target has/lacks memory-management unit coprocessor\n\
***************
*** 7114,7121 ****
#ifdef OBJ_ELF
void m68k_elf_final_processing()
{
! /* Set file-specific flags if this is a cpu32 processor */
if (cpu_of_arch (current_architecture) & cpu32)
elf_elfheader (stdoutput)->e_flags |= EF_CPU32;
}
#endif
--- 7133,7143 ----
#ifdef OBJ_ELF
void m68k_elf_final_processing()
{
! /* Set file-specific flags if this is a cpu32 or sub-68020 processor */
if (cpu_of_arch (current_architecture) & cpu32)
elf_elfheader (stdoutput)->e_flags |= EF_CPU32;
+ else if ((cpu_of_arch (current_architecture) & m68000up)
+ && !(cpu_of_arch (current_architecture) & m68020up))
+ elf_elfheader (stdoutput)->e_flags |= EF_M68000;
}
#endif
Index: gas/config/tc-m68k.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68k.h,v
retrieving revision 1.10
diff -c -r1.10 tc-m68k.h
*** tc-m68k.h 2001/07/18 10:25:58 1.10
--- tc-m68k.h 2001/12/18 17:21:24
***************
*** 230,236 ****
/* Copied from write.c */
/* This was formerly called M68K_AIM_KLUDGE. */
#define md_prepare_relax_scan(fragP, address, aim, this_state, this_type) \
! if (aim==0 && this_state== 4) { /* hard encoded from tc-m68k.c */ \
aim=this_type->rlx_forward+1; /* Force relaxation into word mode */ \
}
--- 230,238 ----
/* Copied from write.c */
/* This was formerly called M68K_AIM_KLUDGE. */
#define md_prepare_relax_scan(fragP, address, aim, this_state, this_type) \
! if (aim == 0 \
! && (this_state == 4 \
! || this_state == 8)) { /* hard encoded from tc-m68k.c */ \
aim=this_type->rlx_forward+1; /* Force relaxation into word mode */ \
}
Index: include/elf/m68k.h
===================================================================
RCS file: /cvs/src/src/include/elf/m68k.h,v
retrieving revision 1.6
diff -c -r1.6 m68k.h
*** m68k.h 2001/03/14 02:27:44 1.6
--- m68k.h 2001/12/18 17:21:26
***************
*** 53,57 ****
--- 53,58 ----
END_RELOC_NUMBERS (R_68K_max)
#define EF_CPU32 0x00810000
+ #define EF_M68000 0x01000000
#endif
[snip]
--
Matt Fredette
http://mit.edu/fredette/www