From a986926b11a79aff93f135b4ef58902128299c0f Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 3 Jan 1997 03:07:01 +0000 Subject: [PATCH] Based on patch from Ronald F. Guilmette : * read.c (read_a_source_file): Check for conditional operators before doing an MRI pending alignment. * config/tc-m68k.h (m68k_conditional_pseudoop): Declare. (tc_conditional_pseudop): Define. * config/tc-m68k.c (m68k_conditional_pseudop): New function. * doc/internals.texi (CPU backend): Describe tc_conditional_pseudoop. --- gas/ChangeLog | 9 +++++++++ gas/config/tc-m68k.c | 12 ++++++++++++ gas/config/tc-m68k.h | 30 ++++++++++++++++++++---------- gas/read.c | 13 +++++++++++-- 4 files changed, 52 insertions(+), 12 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 1e4a048f739..349e17b04ea 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,14 @@ Thu Jan 2 13:37:29 1997 Ian Lance Taylor + Based on patch from Ronald F. Guilmette : + * read.c (read_a_source_file): Check for conditional operators + before doing an MRI pending alignment. + * config/tc-m68k.h (m68k_conditional_pseudoop): Declare. + (tc_conditional_pseudop): Define. + * config/tc-m68k.c (m68k_conditional_pseudop): New function. + * doc/internals.texi (CPU backend): Describe + tc_conditional_pseudoop. + Based on patch from Ronald F. Guilmette : * config/tc-m68k.c (m68k_rel32_from_cmdline): New static variable. diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 27ace69f2de..0e40fa31c02 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -4715,6 +4715,18 @@ s_proc (ignore) /* Pseudo-ops handled for MRI compatibility. */ +/* This function returns non-zero if the argument is a conditional + pseudo-op. This is called when checking whether a pending + alignment is needed. */ + +int +m68k_conditional_pseudoop (pop) + pseudo_typeS *pop; +{ + return (pop->poc_handler == s_mri_if + || pop->poc_handler == s_mri_else); +} + /* Handle an MRI style chip specification. */ static void diff --git a/gas/config/tc-m68k.h b/gas/config/tc-m68k.h index 56028579f5b..85fb20c56bb 100644 --- a/gas/config/tc-m68k.h +++ b/gas/config/tc-m68k.h @@ -1,6 +1,6 @@ /* This file is tc-m68k.h - Copyright (C) 1987, 89, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1987, 89, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -26,12 +26,15 @@ #ifdef OBJ_AOUT #ifdef TE_SUN3 #define TARGET_FORMAT "a.out-sunos-big" -#else +#endif #ifdef TE_NetBSD #define TARGET_FORMAT "a.out-m68k-netbsd" -#else -#define TARGET_FORMAT "a.out-zero-big" #endif +#ifdef TE_LINUX +#define TARGET_FORMAT "a.out-m68k-linux" +#endif +#ifndef TARGET_FORMAT +#define TARGET_FORMAT "a.out-zero-big" #endif #endif @@ -76,6 +79,9 @@ extern int tc_coff_sizemachdep PARAMS ((struct frag *)); extern int m68k_aout_machtype; #endif +#define tc_comment_chars m68k_comment_chars +extern const char *m68k_comment_chars; + #define tc_crawl_symbol_chain(a) {;} /* not used */ #define tc_headers_hook(a) {;} /* not used */ #define tc_aout_pre_write_hook(x) {;} /* not used */ @@ -86,12 +92,6 @@ extern int m68k_aout_machtype; #define LISTING_LHS_CONT_LINES 4/* And 4 lines max */ #define LISTING_HEADER "68K GAS " -/* Copied from write.c */ -#define M68K_AIM_KLUDGE(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 */ \ - } - #ifndef REGISTER_PREFIX #define REGISTER_PREFIX '%' #endif @@ -119,6 +119,9 @@ extern int m68k_aout_machtype; extern void m68k_mri_mode_change PARAMS ((int)); #define MRI_MODE_CHANGE(i) m68k_mri_mode_change (i) +extern int m68k_conditional_pseudoop PARAMS ((pseudo_typeS *)); +#define tc_conditional_pseudoop(pop) m68k_conditional_pseudoop (pop) + #ifdef BFD_ASSEMBLER #define tc_frob_symbol(sym,punt) \ @@ -163,4 +166,11 @@ extern int m68k_parse_long_option PARAMS ((char *)); extern struct relax_type md_relax_table[]; #define TC_GENERIC_RELAX_TABLE md_relax_table +/* 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 */ \ + } + /* end of tc-m68k.h */ diff --git a/gas/read.c b/gas/read.c index 08084af7111..7c4e23a4470 100644 --- a/gas/read.c +++ b/gas/read.c @@ -1,5 +1,5 @@ /* read.c - read a source file - - Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 1996 + Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -692,7 +692,16 @@ read_a_source_file (name) || ! ((pop->poc_handler == cons && pop->poc_val == 1) || (pop->poc_handler == s_space - && pop->poc_val == 1)))) + && pop->poc_val == 1) +#ifdef tc_conditional_pseudoop + || tc_conditional_pseudoop (pop) +#endif + || pop->poc_handler == s_if + || pop->poc_handler == s_ifdef + || pop->poc_handler == s_ifc + || pop->poc_handler == s_ifeqs + || pop->poc_handler == s_else + || pop->poc_handler == s_endif))) { do_align (1, (char *) NULL, 0); mri_pending_align = 0; -- 2.30.2