diff options
author | Alan Modra <amodra@bigpond.net.au> | 2008-09-19 02:11:02 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2008-09-19 02:11:02 +0000 |
commit | d12413cee1ad0a24dc1779f7980e78adc704b2de (patch) | |
tree | 07713a17bd83974de855436c5889c0f3bf7403e1 /gas/write.c | |
parent | d90c83c531837e8a1a4e2509a61288e3380631db (diff) | |
download | binutils-redhat-d12413cee1ad0a24dc1779f7980e78adc704b2de.tar.gz |
* write.c (md_register_arithmetic): Define.
(fixup_segment): Adjust TC_FORCE_RELOCATION_SUB_ABS invocation.
Modify error message when registers involved.
(TC_FORCE_RELOCATION_SUB_ABS): Heed md_register_arithmetic.
* config/tc-sh.h (TC_FORCE_RELOCATION_SUB_ABS): Likewise.
Diffstat (limited to 'gas/write.c')
-rw-r--r-- | gas/write.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/gas/write.c b/gas/write.c index f164e2eeab..f03fcf3d5b 100644 --- a/gas/write.c +++ b/gas/write.c @@ -54,8 +54,13 @@ (! SEG_NORMAL (SEG)) #endif +#ifndef md_register_arithmetic +# define md_register_arithmetic 1 +#endif + #ifndef TC_FORCE_RELOCATION_SUB_ABS -#define TC_FORCE_RELOCATION_SUB_ABS(FIX) 0 +#define TC_FORCE_RELOCATION_SUB_ABS(FIX, SEG) \ + (!md_register_arithmetic && (SEG) == reg_section) #endif #ifndef TC_FORCE_RELOCATION_SUB_LOCAL @@ -924,7 +929,7 @@ fixup_segment (fixS *fixP, segT this_segment) #endif } else if (sub_symbol_segment == absolute_section - && !TC_FORCE_RELOCATION_SUB_ABS (fixP)) + && !TC_FORCE_RELOCATION_SUB_ABS (fixP, add_symbol_segment)) { add_number -= S_GET_VALUE (fixP->fx_subsy); fixP->fx_offset = add_number; @@ -955,12 +960,18 @@ fixup_segment (fixS *fixP, segT this_segment) } else if (!TC_VALIDATE_FIX_SUB (fixP)) { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("can't resolve `%s' {%s section} - `%s' {%s section}"), - fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : "0", - segment_name (add_symbol_segment), - S_GET_NAME (fixP->fx_subsy), - segment_name (sub_symbol_segment)); + if (!md_register_arithmetic + && (add_symbol_segment == reg_section + || sub_symbol_segment == reg_section)) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("register value used as expression")); + else + as_bad_where (fixP->fx_file, fixP->fx_line, + _("can't resolve `%s' {%s section} - `%s' {%s section}"), + fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : "0", + segment_name (add_symbol_segment), + S_GET_NAME (fixP->fx_subsy), + segment_name (sub_symbol_segment)); } } |