diff -Naur binutils-2.14/gas/config/obj-elf.c binutils-2.14.patched/gas/config/obj-elf.c --- binutils-2.14/gas/config/obj-elf.c 2003-05-02 13:06:16.000000000 -0400 +++ binutils-2.14.patched/gas/config/obj-elf.c 2003-07-25 14:40:41.000000000 -0400 @@ -1561,7 +1561,16 @@ return; } input_line_pointer++; + + extern int do_not_generate_delta_symbol; // RM HACK + + do_not_generate_delta_symbol++; + expression (&exp); + + do_not_generate_delta_symbol--; + + if (exp.X_op == O_absent) { as_bad (_("missing expression in .size directive")); diff -Naur binutils-2.14/gas/config/tc-arm.c binutils-2.14.patched/gas/config/tc-arm.c --- binutils-2.14/gas/config/tc-arm.c 2003-04-02 18:31:25.000000000 -0500 +++ binutils-2.14.patched/gas/config/tc-arm.c 2003-07-24 13:33:13.000000000 -0400 @@ -11439,6 +11439,14 @@ #endif } + +extern int hack_current_data_type; // RM HACK + +#define DATA_TYPE_ARM 1 // RM HACK +#define DATA_TYPE_THUMB 2 // RM HACK +#define DATA_TYPE_DATA 2 // RM HACK + + void md_assemble (str) char * str; @@ -11489,6 +11497,13 @@ if (opcode) { + + if( hack_current_data_type != DATA_TYPE_THUMB ) // RM HACK + { + symbol_new ("$t", now_seg, (valueT) frag_now_fix (), frag_now); // RM HACK + hack_current_data_type = DATA_TYPE_THUMB; // RM HACK + } + /* Check that this instruction is supported for this CPU. */ if (thumb_mode == 1 && (opcode->variant & cpu_variant) == 0) { @@ -11514,6 +11529,12 @@ if (opcode) { + if( hack_current_data_type != DATA_TYPE_ARM ) // RM HACK + { + symbol_new ("$a", now_seg, (valueT) frag_now_fix (), frag_now); // RM HACK + hack_current_data_type = DATA_TYPE_ARM; // RM HACK + } + /* Check that this instruction is supported for this CPU. */ if ((opcode->variant & cpu_variant) == 0) { @@ -12619,6 +12640,12 @@ return; } + if( hack_current_data_type != DATA_TYPE_DATA ) // RM HACK + { + symbol_new ("$d", now_seg, (valueT) frag_now_fix (), frag_now); // RM HACK + hack_current_data_type = DATA_TYPE_DATA; // RM HACK + } + #ifdef md_cons_align md_cons_align (nbytes); #endif diff -Naur binutils-2.14/gas/ecoff.c binutils-2.14.patched/gas/ecoff.c --- binutils-2.14/gas/ecoff.c 2002-08-27 07:09:42.000000000 -0400 +++ binutils-2.14.patched/gas/ecoff.c 2003-07-25 14:37:50.000000000 -0400 @@ -2658,7 +2658,15 @@ for (i = 0; i < N_TQ; i++) { SKIP_WHITESPACE (); + + extern int do_not_generate_delta_symbol; // RM HACK + + do_not_generate_delta_symbol++; // RM HACK + sizes[i] = get_absolute_expression (); + + do_not_generate_delta_symbol--; // RM HACK + if (*input_line_pointer == ',') ++input_line_pointer; else diff -Naur binutils-2.14/gas/expr.c binutils-2.14.patched/gas/expr.c --- binutils-2.14/gas/expr.c 2002-10-17 21:56:39.000000000 -0400 +++ binutils-2.14.patched/gas/expr.c 2003-07-25 15:10:18.000000000 -0400 @@ -1636,8 +1636,33 @@ /* NOTREACHED */ } +/* HACK to generate extra symbols for differences */ + +int do_not_generate_delta_symbol = 0; + +void hack_add_delta_symbol(symbolS *lhs, symbolS *rhs) +{ + int do_not_generate_delta_symbol; + + if( do_not_generate_delta_symbol > 0) return; + + const char * left_name=S_GET_NAME(lhs); + const char * right_name=S_GET_NAME(rhs); + char * new_sym_name=malloc(strlen(left_name)+strlen(right_name)+strlen("$delta:@-@")+1); + + strcpy(new_sym_name,"$delta:"); + strcat(new_sym_name,left_name); + strcat(new_sym_name,"@-@"); + strcat(new_sym_name,right_name); + + symbol_new (new_sym_name, now_seg, (valueT) frag_now_fix (), frag_now); + symbol_mark_used_in_reloc (lhs); + symbol_mark_used_in_reloc (rhs); +} + /* Parse an expression. */ + segT expr (rankarg, resultP) int rankarg; /* Larger # is higher rank. */ @@ -1748,7 +1773,9 @@ == symbol_get_frag (resultP->X_add_symbol)) && (SEG_NORMAL (rightseg) || right.X_add_symbol == resultP->X_add_symbol)) - { + { + hack_add_delta_symbol(resultP->X_add_symbol,right.X_add_symbol); // HACK + resultP->X_add_number -= right.X_add_number; resultP->X_add_number += (S_GET_VALUE (resultP->X_add_symbol) - S_GET_VALUE (right.X_add_symbol)); @@ -1843,6 +1870,8 @@ resultP->X_add_number += right.X_add_number; else if (op_left == O_subtract) { + hack_add_delta_symbol( resultP->X_add_symbol, right.X_add_symbol); // HACK + resultP->X_add_number -= right.X_add_number; if (retval == rightseg && SEG_NORMAL (retval)) { diff -Naur binutils-2.14/gas/read.c binutils-2.14.patched/gas/read.c --- binutils-2.14/gas/read.c 2003-06-02 16:35:23.000000000 -0400 +++ binutils-2.14.patched/gas/read.c 2003-07-24 13:33:13.000000000 -0400 @@ -3400,10 +3400,20 @@ mri_comment_end (stop, stopc); } +int hack_current_data_type=0; // RM HACK +#define DATA_TYPE_DATA 2 // RM HACK + + void cons (size) int size; { + if ( hack_current_data_type != DATA_TYPE_DATA ) // RM HACK + { + symbol_new ("$d", now_seg, (valueT) frag_now_fix (), frag_now); + hack_current_data_type = DATA_TYPE_DATA; + } + cons_worker (size, 0); } @@ -3411,6 +3421,12 @@ s_rva (size) int size; { + if ( hack_current_data_type != DATA_TYPE_DATA ) // RM HACK + { + symbol_new ("$d", now_seg, (valueT) frag_now_fix (), frag_now); + hack_current_data_type = DATA_TYPE_DATA; + } + cons_worker (size, 1); } @@ -4131,6 +4147,12 @@ md_flush_pending_output (); #endif + if ( hack_current_data_type != DATA_TYPE_DATA ) // RM HACK + { + symbol_new ("$d", now_seg, (valueT) frag_now_fix (), frag_now); + hack_current_data_type = DATA_TYPE_DATA; + } + do { /* input_line_pointer->1st char of a flonum (we hope!). */