/
gas-2.16-tigcc-patch.diff
1744 lines (1618 loc) · 62.1 KB
/
gas-2.16-tigcc-patch.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -aur binutils-2.16.1.orig/bfd/coffcode.h binutils-2.16.1-src/bfd/coffcode.h
--- binutils-2.16.1.orig/bfd/coffcode.h 2005-02-24 21:16:55.000000000 +0100
+++ binutils-2.16.1-src/bfd/coffcode.h 2011-07-01 15:46:35.000000000 +0200
@@ -4995,6 +4995,9 @@
cache_ptr = reloc_cache + idx;
src = native_relocs + idx;
+ // (GCC4TI) HACK: mask out COFF_RELOC_UNOPTIMIZABLE, to make binutils more usable with archives containing that non-standard flag.
+ src->r_type[0] &= ~0x80;
+
coff_swap_reloc_in (abfd, src, &dst);
#ifdef RELOC_PROCESSING
diff -Naur binutils-2.16.1.orig/bfd/config.bfd binutils-2.16.1-src/bfd/config.bfd
--- binutils-2.16.1.orig/bfd/config.bfd 2005-01-31 18:18:46.000000000 +0100
+++ binutils-2.16.1-src/bfd/config.bfd 2005-07-01 00:40:16.000000000 +0200
@@ -708,7 +708,6 @@
;;
m68*-*-coff* | m68*-*-sysv*)
targ_defvec=m68kcoff_vec
- targ_selvecs="m68kcoff_vec versados_vec ieee_vec"
;;
m68*-*-hpux*)
targ_defvec=hp300hpux_vec
diff -Naur binutils-2.16.1.orig/bfd/opncls.c binutils-2.16.1-src/bfd/opncls.c
--- binutils-2.16.1.orig/bfd/opncls.c 2005-03-07 11:32:38.000000000 +0100
+++ binutils-2.16.1-src/bfd/opncls.c 2007-10-02 16:12:11.000000000 +0200
@@ -483,7 +483,7 @@
nbfd->filename = filename;
nbfd->direction = read_direction;
- stream = open (nbfd, open_closure);
+ stream = (open) (nbfd, open_closure);
if (stream == NULL)
{
_bfd_delete_bfd (nbfd);
diff -Naur binutils-2.16.1.orig/gas/as.c binutils-2.16.1-src/gas/as.c
--- binutils-2.16.1.orig/gas/as.c 2005-03-03 02:29:52.000000000 +0100
+++ binutils-2.16.1-src/gas/as.c 2007-02-18 22:05:31.000000000 +0100
@@ -251,6 +251,14 @@
s include symbols\n\
=FILE list to FILE (must be last sub-option)\n"));
+/* (TIGCC 20050732) */
+ fprintf (stream, _("\
+ --a68k assemble in A68k compatibility mode\n"));
+
+/* (TIGCC 20030716) */
+ fprintf (stream, _("\
+ --all-relocs output all relocs, implies --keep-locals (-L)\n"));
+
fprintf (stream, _("\
--alternate initially turn on alternate macro syntax\n"));
fprintf (stream, _("\
@@ -426,7 +434,10 @@
OPTION_EXECSTACK,
OPTION_NOEXECSTACK,
OPTION_ALTERNATE,
- OPTION_WARN_FATAL
+ OPTION_AL,
+ OPTION_WARN_FATAL,
+ OPTION_ALL_RELOCS, /* (TIGCC 20030716) */
+ OPTION_A68K /* (TIGCC 20050731) */
/* When you add options here, check that they do
not collide with OPTION_MD_BASE. See as.h. */
};
@@ -442,6 +453,12 @@
necessary because -a=<FILE> is a valid switch but getopt would
normally reject it since --alternate does not take an argument. */
,{"a", optional_argument, NULL, 'a'}
+ /* Handle -al=<FILE>. */
+ ,{"al", optional_argument, NULL, OPTION_AL}
+/* (TIGCC 20050731) */
+ ,{"a68k", no_argument, NULL, OPTION_A68K}
+/* (TIGCC 20030716) */
+ ,{"all-relocs", no_argument, NULL, OPTION_ALL_RELOCS}
,{"defsym", required_argument, NULL, OPTION_DEFSYM}
,{"dump-config", no_argument, NULL, OPTION_DUMPCONFIG}
,{"emulation", required_argument, NULL, OPTION_EMULATION}
@@ -735,6 +752,9 @@
listing_lhs_cont_lines = atoi (optarg);
break;
+ case OPTION_A68K: /* (TIGCC 20050731) */
+ flag_a68k = 1;
+ /* fall through */
case 'M':
flag_mri = 1;
#ifdef TC_M68K
@@ -775,6 +795,12 @@
flag_always_generate_output = 1;
break;
+ case OPTION_AL:
+ listing |= LISTING_LISTING;
+ if (optarg)
+ listing_filename = xstrdup (optarg);
+ break;
+
case OPTION_ALTERNATE:
optarg = old_argv [optind - 1];
while (* optarg == '-')
@@ -865,6 +891,12 @@
case 'X':
/* -X means treat warnings as errors. */
break;
+
+ /* (TIGCC 20030716) */
+ case OPTION_ALL_RELOCS:
+ flag_all_relocs = 1;
+ flag_keep_locals = 1; /* implies -L */
+ break;
}
}
diff -Naur binutils-2.16.1.orig/gas/as.h binutils-2.16.1-src/gas/as.h
--- binutils-2.16.1.orig/gas/as.h 2005-04-13 20:58:40.000000000 +0200
+++ binutils-2.16.1-src/gas/as.h 2005-07-31 19:40:04.000000000 +0200
@@ -244,16 +244,22 @@
#ifdef MANY_SEGMENTS
#include "bfd.h"
-#define N_SEGMENTS 40
-#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_E39)
-#define SEG_LIST SEG_E0,SEG_E1,SEG_E2,SEG_E3,SEG_E4,SEG_E5,SEG_E6,SEG_E7,SEG_E8,SEG_E9,\
- SEG_E10,SEG_E11,SEG_E12,SEG_E13,SEG_E14,SEG_E15,SEG_E16,SEG_E17,SEG_E18,SEG_E19,\
- SEG_E20,SEG_E21,SEG_E22,SEG_E23,SEG_E24,SEG_E25,SEG_E26,SEG_E27,SEG_E28,SEG_E29,\
- SEG_E30,SEG_E31,SEG_E32,SEG_E33,SEG_E34,SEG_E35,SEG_E36,SEG_E37,SEG_E38,SEG_E39
+/* (TIGCC 20040625) 40 sections are definitely not enough for
+ -ffunction-sections, -fdata-sections and the like.
+ So I increased them to 120. -- Kevin Kofler
+ (TIGCC 20040905) And again to 1024. -- Kevin Kofler */
+#define N_SEGMENTS 1024
+#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_LAST)
+#define LIST_10_(decade) decade##0,decade##1,decade##2,decade##3,decade##4,decade##5,decade##6,decade##7,decade##8,decade##9
+#define LIST_FIRST_100_(century) LIST_10_(century),LIST_10_(century##1),LIST_10_(century##2),LIST_10_(century##3),LIST_10_(century##4),LIST_10_(century##5),LIST_10_(century##6),LIST_10_(century##7),LIST_10_(century##8),LIST_10_(century##9)
+#define LIST_100_(century) LIST_10_(century##0),LIST_10_(century##1),LIST_10_(century##2),LIST_10_(century##3),LIST_10_(century##4),LIST_10_(century##5),LIST_10_(century##6),LIST_10_(century##7),LIST_10_(century##8),LIST_10_(century##9)
+#define LIST_FIRST_1000_(millennium) LIST_FIRST_100_(millennium),LIST_100_(millennium##1),LIST_100_(millennium##2),LIST_100_(millennium##3),LIST_100_(millennium##4),LIST_100_(millennium##5),LIST_100_(millennium##6),LIST_100_(millennium##7),LIST_100_(millennium##8),LIST_100_(millennium##9)
+#define SEG_LIST LIST_FIRST_1000_(SEG_E),LIST_10_(SEG_E100),LIST_10_(SEG_E101),\
+ SEG_E1020,SEG_E1021,SEG_E1022,SEG_E1023
#define SEG_TEXT SEG_E0
#define SEG_DATA SEG_E1
#define SEG_BSS SEG_E2
-#define SEG_LAST SEG_E39
+#define SEG_LAST SEG_E1023
#else
#define N_SEGMENTS 3
#define SEG_NORMAL(x) ((x) == SEG_TEXT || (x) == SEG_DATA || (x) == SEG_BSS)
@@ -294,8 +300,13 @@
#ifdef BFD_ASSEMBLER
#define segment_name(SEG) bfd_get_section_name (stdoutput, SEG)
#else
+/* (TIGCC 20040905) Allow arbitrary number of sections here. -- Kevin Kofler */
+#if 0
extern char const *const seg_name[];
-#define segment_name(SEG) seg_name[(int) (SEG)]
+#define segment_name(SEG) seg_name[(int) (SEG)]*/
+#else
+char *segment_name PARAMS ((int));
+#endif
#endif
#ifndef BFD_ASSEMBLER
@@ -481,6 +492,12 @@
extern enum debug_info_type debug_type;
extern int use_gnu_debug_info_extensions;
+
+/* (TIGCC 20030716) True if all relocs should be retained. */
+COMMON unsigned char flag_all_relocs; /* --all-relocs */
+
+/* (TIGCC 20050731) True if assembling in A68k compatibility mode. */
+COMMON unsigned char flag_a68k; /* --a68k */
/* Maximum level of macro nesting. */
extern int max_macro_nest;
diff -Naur binutils-2.16.1.orig/gas/config/obj-coff.c binutils-2.16.1-src/gas/config/obj-coff.c
--- binutils-2.16.1.orig/gas/config/obj-coff.c 2005-03-01 12:24:30.000000000 +0100
+++ binutils-2.16.1-src/gas/config/obj-coff.c 2006-11-18 19:31:57.000000000 +0100
@@ -25,6 +25,7 @@
#include "as.h"
#include "obstack.h"
#include "subsegs.h"
+#include "dwarf2dbg.h"
#ifdef TE_PE
#include "coff/pe.h"
@@ -1695,7 +1696,7 @@
section alignment, then skip this step, as TICOFF does. */
size = bfd_get_section_size (sec);
mask = ((bfd_vma) 1 << align_power) - 1;
-#if !defined(TICOFF)
+#if 0 /*!defined(TICOFF)*/
if (size & mask)
{
bfd_vma new_size;
@@ -1834,14 +1835,20 @@
/* This vector is used to turn a gas internal segment number into a
section number suitable for insertion into a coff symbol table.
This must correspond to seg_info_off_by_4. */
+/* (TIGCC 20040625) 40 sections are definitely not enough for
+ -ffunction-sections, -fdata-sections and the like.
+ So I increased them to 120. -- Kevin Kofler */
const short seg_N_TYPE[] =
{ /* in: segT out: N_TYPE bits */
+/* (TIGCC 20040905) Allow arbitrary number of sections here. -- Kevin Kofler */
+#if 0
C_ABS_SECTION,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+#endif /*0*/
C_UNDEF_SECTION, /* SEG_UNKNOWN */
C_UNDEF_SECTION, /* SEG_GOOF */
C_UNDEF_SECTION, /* SEG_EXPR */
@@ -1851,6 +1858,13 @@
C_REGISTER_SECTION, /* SEG_REGISTER */
};
+short SEGMENT_TO_SYMBOL_TYPE (n) int n;
+{
+ if (!n) return C_ABS_SECTION;
+ else if (SEG_NORMAL(n)) return n-SEG_E0+1;
+ else return seg_N_TYPE[n-(N_SEGMENTS+1)];
+}
+
int function_lineoff = -1; /* Offset in line#s where the last function
started (the odd entry for line #0) */
@@ -1918,6 +1932,8 @@
SEG_DEBUG,
SEG_ABSOLUTE,
SEG_UNKNOWN,
+/* (TIGCC 20040905) Allow arbitrary number of sections here. -- Kevin Kofler */
+#if 0
SEG_E0, SEG_E1, SEG_E2, SEG_E3, SEG_E4,
SEG_E5, SEG_E6, SEG_E7, SEG_E8, SEG_E9,
SEG_E10, SEG_E11, SEG_E12, SEG_E13, SEG_E14,
@@ -1936,9 +1952,19 @@
(segT) 0,
(segT) 0,
SEG_REGISTER
+#endif /*0*/
};
-#define SEG_INFO_FROM_SECTION_NUMBER(x) (seg_info_off_by_4[(x)+4])
+static segT SEG_INFO_FROM_SECTION_NUMBER PARAMS ((int));
+
+static segT SEG_INFO_FROM_SECTION_NUMBER (n) int n;
+{
+ if (n<=0) return seg_info_off_by_4[n+4];
+ else if (n<=N_SEGMENTS) return n-1+SEG_E0;
+ else if (n<=N_SEGMENTS+6) return n-1;
+ else if (n==C_REGISTER_SECTION) return SEG_REGISTER;
+ else return 0;
+}
static relax_addressT relax_align PARAMS ((relax_addressT, long));
@@ -2010,6 +2036,12 @@
size += off;
}
break;
+ case rs_cfa:
+ size += frag->fr_fix + eh_frame_estimate_size_before_relax (frag);
+ break;
+ case rs_dwarf2dbg:
+ size += frag->fr_fix + dwarf2dbg_estimate_size_before_relax (frag);
+ break;
default:
BAD_CASE (frag->fr_type);
break;
@@ -2159,8 +2191,11 @@
S_GET_NAME (symbol_ptr));
}
+/* (TIGCC 20030715) Don't convert references to references to the section symbol.
+ (TIGCC 20030805) ... except for local symbols!
+ -- Kevin Kofler */
dot = segment_info[S_GET_SEGMENT (symbol_ptr)].dot;
- if (dot)
+ if (dot && S_IS_LOCAL(symbol_ptr))
intr.r_symndx = dot->sy_number;
else
intr.r_symndx = symbol_ptr->sy_number;
@@ -2309,6 +2344,16 @@
}
break;
+
+ case rs_cfa:
+ eh_frame_convert_frag (frag);
+ goto have_converted_rs_fill;
+
+ case rs_dwarf2dbg:
+ dwarf2dbg_convert_frag (frag);
+ /* fall through */
+
+ have_converted_rs_fill:
case rs_space:
case rs_fill:
case rs_align:
@@ -3218,6 +3263,11 @@
tc_frob_coff_symbol (symbolP);
#endif
+ /* (TIGCC 20040725) Clear the SF_LOCAL flag if the symbol is in a
+ mergeable section. -- Kevin Kofler */
+ if (segment_info[S_GET_SEGMENT (symbolP)].scnhdr.s_flags & STYP_MERGEABLE)
+ SF_CLEAR_LOCAL (symbolP);
+
/* We must put the external symbols apart. The loader
does not bomb if we do not. But the references in
the endndx field for a .bb symbol are not corrected
@@ -3559,7 +3609,7 @@
(!(FRCHAIN)->frch_next || (FRCHAIN)->frch_next->frch_seg != (SEG) \
? get_recorded_alignment (SEG) : 0)
#else
-#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 1
+#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0 /*1*/
#endif
#endif
@@ -3767,7 +3817,9 @@
{
unsigned int i;
-#ifndef COFF_LONG_SECTION_NAMES
+/* (TIGCC 20040625) Use the full name, not the truncated name, for merging of
+ identically-named sections. -- Kevin Kofler */
+#if 0 /*ndef COFF_LONG_SECTION_NAMES*/
char buf[SCNNMLEN + 1];
strncpy (buf, name, SCNNMLEN);
@@ -3870,6 +3922,9 @@
case 'w': flags |= STYP_DATA; break;
case 'x': flags |= STYP_TEXT; break;
case 'r': flags |= STYP_LIT; break;
+/* (TIGCC 20040724) TIGCC COFF extensions for section flags -- Kevin Kofler */
+ case 'm': flags |= STYP_MERGEABLE; break;
+ case 'u': flags |= STYP_UNALIGNED; break;
default:
as_warn(_("unknown section attribute '%c'"),
*input_line_pointer);
@@ -4029,6 +4084,13 @@
symbol_remove (symbolP, &symbol_rootP, &symbol_lastP);
symbol_insert (symbolP, symbol_rootP, &symbol_rootP, &symbol_lastP);
}
+
+ /* (TIGCC 20030717) In all-relocs mode, add an __ld_all_relocs symbol pointing
+ to a dummy label in the text section. -- Kevin Kofler */
+ if (flag_all_relocs) {
+ symbolP = symbol_new("__ld_all_relocs", SEG_TEXT, 0, &zero_address_frag);
+ S_SET_EXTERNAL(symbolP); /* make it an xdef */
+ }
}
/* Build a 'section static' symbol. */
@@ -4344,10 +4406,13 @@
#endif /* TC_I960 */
add_number += S_GET_VALUE (add_symbolP) -
S_GET_VALUE (sub_symbolP);
- add_symbolP = NULL;
if (!TC_FORCE_RELOCATION (fixP))
{
+ /* (TIGCC 20030717) Zero out add_symbolP only if !TC_FORCE_RELOCATION.
+ -- Kevin Kofler */
+ add_symbolP = NULL;
+
fixP->fx_addsy = NULL;
fixP->fx_subsy = NULL;
fixP->fx_done = 1;
@@ -4368,6 +4433,8 @@
#ifdef DIFF_EXPR_OK
else if (S_GET_SEGMENT (sub_symbolP) == this_segment_type)
{
+/* (TIGCC 20030716) Take TC_FORCE_RELOCATION_SUB_LOCAL into account. -- Kevin Kofler */
+ if (!TC_FORCE_RELOCATION_SUB_LOCAL (fixP)) {
/* Make it pc-relative. */
add_number += (md_pcrel_from (fixP)
- S_GET_VALUE (sub_symbolP));
@@ -4375,15 +4442,19 @@
fixP->fx_pcrel = 1;
sub_symbolP = 0;
fixP->fx_subsy = 0;
+ }
}
#endif
else
{
+/* (TIGCC 20030716) Take UNDEFINED_DIFFERENCE_OK into account. -- Kevin Kofler */
+#ifndef UNDEFINED_DIFFERENCE_OK
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %ld."),
segment_name (S_GET_SEGMENT (sub_symbolP)),
S_GET_NAME (sub_symbolP),
(long) (fragP->fr_address + where));
+#endif
}
}
}
@@ -4522,7 +4593,13 @@
md_apply_fix3 (fixP, (valueT *) & add_number, this_segment_type);
- if (!fixP->fx_bit_fixP && ! fixP->fx_no_overflow)
+/* (TIGCC 20030716) Reuse fx_im_disp to turn off range checking on the 68k.
+ -- Kevin Kofler */
+ if (!fixP->fx_bit_fixP && ! fixP->fx_no_overflow
+#ifdef TC_M68K
+ && !fixP->fx_im_disp
+#endif
+ )
{
#ifndef TC_M88K
/* The m88k uses the offset field of the reloc to get around
diff -Naur binutils-2.16.1.orig/gas/config/obj-coff.h binutils-2.16.1-src/gas/config/obj-coff.h
--- binutils-2.16.1.orig/gas/config/obj-coff.h 2005-03-03 12:47:48.000000000 +0100
+++ binutils-2.16.1-src/gas/config/obj-coff.h 2005-07-01 00:40:16.000000000 +0200
@@ -487,7 +487,8 @@
#define C_DEBUG_SECTION N_DEBUG
#define C_NTV_SECTION N_TV
#define C_PTV_SECTION P_TV
-#define C_REGISTER_SECTION 50
+/* (TIGCC 20040905) Don't hardcode number of sections here. -- Kevin Kofler */
+#define C_REGISTER_SECTION (N_SEGMENTS+10)
/* Macros to extract information from a symbol table entry.
This syntactic indirection allows independence regarding a.out or coff.
@@ -510,20 +511,31 @@
/* Return true for symbols that should not be reduced to section
symbols or eliminated from expressions, because they may be
overridden by the linker. */
+/* (TIGCC 20030716) Never reduce or eliminate relocs in all-relocs mode.
+ (TIGCC 20040719) Don't force relocs for absolute symbols if !flag_all_relocs.
+ (TIGCC 20040725) Force relocs for symbols in mergeable sections.
+ -- Kevin Kofler */
#define S_FORCE_RELOC(s, strict) \
- (!SEG_NORMAL (S_GET_SEGMENT (s)) || (strict && S_IS_WEAK (s)))
+ ((!SEG_NORMAL (S_GET_SEGMENT (s)) && S_GET_SEGMENT (s) != absolute_section) \
+ || (strict && S_IS_WEAK (s)) || flag_all_relocs \
+ || (segment_info[S_GET_SEGMENT (s)].scnhdr.s_flags & STYP_MERGEABLE))
/* True if a debug special symbol entry. */
#define S_IS_DEBUG(s) \
((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION)
/* True if a symbol is local symbol name. */
-/* A symbol name whose name includes ^A is a gas internal pseudo symbol. */
+/* A symbol name whose name includes ^A is a gas internal pseudo symbol.
+ (TIGCC 20030716) However, we want them output when outputting local symbols.
+ (TIGCC 20040724) Also, we always want to output local symbols in mergeable
+ sections, because our linker relies on that.
+ -- Kevin Kofler */
#define S_IS_LOCAL(s) \
((s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION \
- || (S_LOCAL_NAME(s) && ! flag_keep_locals && ! S_IS_DEBUG (s)) \
- || strchr (S_GET_NAME (s), '\001') != NULL \
- || strchr (S_GET_NAME (s), '\002') != NULL \
+ || (S_LOCAL_NAME(s) && ! flag_keep_locals && ! S_IS_DEBUG (s) \
+ && !(segment_info[S_GET_SEGMENT (s)].scnhdr.s_flags & STYP_MERGEABLE)) \
+ || (strchr (S_GET_NAME (s), '\001') != NULL && ! flag_keep_locals) \
+ || (strchr (S_GET_NAME (s), '\002') != NULL && ! flag_keep_locals) \
|| (flag_strip_local_absolute \
&& !S_IS_EXTERNAL(s) \
&& (s)->sy_symbol.ost_entry.n_scnum == C_ABS_SECTION))
diff -Naur binutils-2.16.1.orig/gas/config/tc-m68k.c binutils-2.16.1-src/gas/config/tc-m68k.c
--- binutils-2.16.1.orig/gas/config/tc-m68k.c 2005-03-22 16:31:48.000000000 +0100
+++ binutils-2.16.1-src/gas/config/tc-m68k.c 2006-11-18 18:09:33.000000000 +0100
@@ -79,6 +79,7 @@
int flag_want_pic;
static int flag_short_refs; /* -l option. */
+static int flag_short_jumps; /* --short-jumps option */
static int flag_long_jumps; /* -S option. */
static int flag_keep_pcrel; /* --pcrel option. */
@@ -579,6 +580,10 @@
{"extend", float_cons, 'x'},
{"ldouble", float_cons, 'x'},
+ /* Dwarf2 support for Gcc. */
+ {"file", (void (*) PARAMS ((int))) dwarf2_directive_file, 0},
+ {"loc", dwarf2_directive_loc, 0},
+
/* The following pseudo-ops are supported for MRI compatibility. */
{"chip", s_chip, 0},
{"comline", s_space, 1},
@@ -777,15 +782,24 @@
short
tc_coff_fix2rtype (fixS *fixP)
{
+/* (TIGCC 20040920) Handle unoptimizable relocs. -- Kevin Kofler */
+ short isunopt;
+ isunopt = (fixP->fx_unoptimizable) ? R_UNOPTIMIZABLE : 0;
+
if (fixP->fx_tcbit && fixP->fx_size == 4)
- return R_RELLONG_NEG;
+ return isunopt | R_RELLONG_NEG;
+/* (TIGCC 20030716) Handle word and byte negative relocs. -- Kevin Kofler */
+ if (fixP->fx_tcbit && fixP->fx_size == 2)
+ return isunopt | R_RELWORD_NEG;
+ if (fixP->fx_tcbit && fixP->fx_size == 1)
+ return isunopt | R_RELBYTE_NEG;
#ifdef NO_PCREL_RELOCS
know (fixP->fx_pcrel == 0);
- return (fixP->fx_size == 1 ? R_RELBYTE
+ return isunopt | (fixP->fx_size == 1 ? R_RELBYTE
: fixP->fx_size == 2 ? R_DIR16
: R_DIR32);
#else
- return (fixP->fx_pcrel
+ return isunopt | (fixP->fx_pcrel
? (fixP->fx_size == 1 ? R_PCRBYTE
: fixP->fx_size == 2 ? R_PCRWORD
: R_PCRLONG)
@@ -1089,6 +1103,7 @@
char c;
int losing;
int opsfound;
+ struct m68k_op operands_backup[6];
LITTLENUM_TYPE words[6];
LITTLENUM_TYPE *wordp;
unsigned long ok_arch = 0;
@@ -1213,7 +1228,15 @@
++losing;
else
{
- for (s = opcode->m_operands, opP = &the_ins.operands[0];
+ int i;
+
+ /* Make a copy of the operands of this insn so that
+ we can modify them safely, should we want to. */
+ assert (opsfound <= (int) ARRAY_SIZE (operands_backup));
+ for (i = 0; i < opsfound; i++)
+ operands_backup[i] = the_ins.operands[i];
+
+ for (s = opcode->m_operands, opP = &operands_backup[0];
*s && !losing;
s += 2, opP++)
{
@@ -1974,6 +1997,12 @@
if (losing)
break;
}
+
+ /* Since we have found the correct instruction, copy
+ in the modifications that we may have made. */
+ if (!losing)
+ for (i = 0; i < opsfound; i++)
+ the_ins.operands[i] = operands_backup[i];
}
if (!losing)
@@ -2759,6 +2788,7 @@
add_fix ('B', &opP->disp, 1, -1);
break;
case 'W':
+ word_branch: /* (TIGCC 20050130) */
add_fix ('w', &opP->disp, 1, 0);
addword (0);
break;
@@ -2771,6 +2801,20 @@
addword (0);
addword (0);
break;
+ case 'G': /* (TIGCC 20050130) */
+ /* (TIGCC 20050130) We want only branches (word). -- Kevin Kofler */
+ if (subs (&opP->disp)) /* We can't relax it. */
+ goto word_branch;
+
+#ifdef OBJ_ELF
+ /* If the displacement needs pic relocation it cannot be
+ relaxed. */
+ if (opP->disp.pic_reloc != pic_none)
+ goto word_branch;
+#endif
+ add_frag (adds (&opP->disp), offs (&opP->disp),
+ TAB (BRANCHBW, SZ_UNDEF));
+ break;
case 'g':
if (subs (&opP->disp)) /* We can't relax it. */
goto long_branch;
@@ -2793,8 +2837,15 @@
the_ins.opcode[0] = 0x4EB9;
else /* jCC */
{
+ /* (TIGCC 20030902) Add a PC-relative reloc (unconditionally, because
+ it will be removed later on if not in all-relocs
+ mode). -- Kevin Kofler */
+ struct m68k_exp temp_expr = {SIZE_UNSPEC,
+ {symbol_new (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix () + 8, frag_now),
+ NULL, 0, O_symbol, 0, 0}};
the_ins.opcode[0] ^= 0x0100;
the_ins.opcode[0] |= 0x0006;
+ add_fix ('B' /*case-sensitive!*/, &temp_expr, 1 /*PCREL*/, -1 /*PCREL fix for bytes*/);
addword (0x4EF9);
}
add_fix ('l', &opP->disp, 0, 0);
@@ -3955,7 +4006,7 @@
current_label = NULL;
}
-#ifdef OBJ_ELF
+#if 1 /*def OBJ_ELF*/
/* Tie dwarf2 debug info to the address at the start of the insn. */
dwarf2_emit_insn (0);
#endif
@@ -4008,6 +4059,13 @@
fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix;
if (the_ins.reloc[m].wid == 'B')
fixP->fx_signed = 1;
+ /* (TIGCC 20050130) These relocs are by definition the ones which cannot
+ be "relaxed" - or "optimized" in ld-tigcc terms.
+ Excepted from this are byte branches because the
+ linker must be able to remove them entirely.
+ -- Kevin Kofler */
+ else
+ fixP->fx_unoptimizable = 1;
}
return;
}
@@ -4068,6 +4126,10 @@
get_reloc_code (wid, the_ins.reloc[m].pcrel,
the_ins.reloc[m].pic_reloc));
fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix;
+ /* (TIGCC 20050130) These relocs are by definition the ones which cannot
+ be "relaxed" - or "optimized" in ld-tigcc terms.
+ -- Kevin Kofler */
+ fixP->fx_unoptimizable = 1;
}
(void) frag_var (rs_machine_dependent, 10, 0,
(relax_substateT) (the_ins.fragb[n].fragty),
@@ -4105,6 +4167,10 @@
get_reloc_code (wid, the_ins.reloc[m].pcrel,
the_ins.reloc[m].pic_reloc));
fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix;
+ /* (TIGCC 20050130) These relocs are by definition the ones which cannot
+ be "relaxed" - or "optimized" in ld-tigcc terms.
+ -- Kevin Kofler */
+ fixP->fx_unoptimizable = 1;
}
}
@@ -4126,6 +4192,8 @@
return ret;
if (op1 < op2)
return -1;
+ if (op1 > op2)
+ return 1; /* (TIGCC 200505611) This is required for Windows. -- Kevin Kofler */
return 0;
}
@@ -4160,7 +4228,7 @@
m68k_sorted_opcodes = xmalloc (m68k_numopcodes * sizeof (* m68k_sorted_opcodes));
if (!m68k_sorted_opcodes)
as_fatal (_("Internal Error: Can't allocate m68k_sorted_opcodes of size %d"),
- m68k_numopcodes * sizeof (* m68k_sorted_opcodes));
+ m68k_numopcodes * ((int) sizeof (* m68k_sorted_opcodes)));
for (i = m68k_numopcodes; i--;)
m68k_sorted_opcodes[i] = m68k_opcodes + i;
@@ -4619,7 +4687,9 @@
val = SEXT (val);
- if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+/* (TIGCC 20030716) We aren't done when we still have something to subtract.
+ -- Kevin Kofler */
+ if (fixP->fx_addsy == NULL && fixP->fx_subsy == NULL && fixP->fx_pcrel == 0)
fixP->fx_done = 1;
#ifdef OBJ_ELF
@@ -4642,6 +4712,55 @@
return;
#endif
+ /* Fix up a negative reloc. */
+ if (fixP->fx_addsy == NULL && fixP->fx_subsy != NULL)
+ {
+ fixP->fx_addsy = fixP->fx_subsy;
+ fixP->fx_subsy = NULL;
+ fixP->fx_tcbit = 1;
+ val = -val; /* (TIGCC 20030716) */
+ }
+ /* (TIGCC 20030716) Fix up an address difference by splitting it into its
+ components.
+ Fix up subtraction of the dot symbol by changing the reloc
+ to PC-relative (disabled 20030717). -- Kevin Kofler
+ (TIGCC 20040807) For common symbols, the value is the size, not the
+ position, so don't use it. -- Kevin Kofler */
+ else if (fixP->fx_addsy != NULL && fixP->fx_subsy != NULL)
+ {
+#if 0 /* (TIGCC 20030717) This is unnecessary (see expr.c fix) and probably wrong. */
+ if (!~fixP->fx_subsy->sy_number) { /* detect the dot symbol */
+ /* make the reloc PC-relative: */
+ val += md_pcrel_from (fixP);
+ fixP->fx_offset = *valP = val;
+ fixP->fx_pcrel = 1;
+ fixP->fx_subsy = NULL;
+ } else {
+#endif
+ fixS *negreloc = fix_new (fixP->fx_frag, fixP->fx_where, fixP->fx_size,
+ fixP->fx_subsy, fixP->fx_offset
+ + (S_IS_COMMON (fixP->fx_addsy) ? 0 : S_GET_VALUE (fixP->fx_addsy))
+ + segment_info[S_GET_SEGMENT (fixP->fx_addsy)].scnhdr.s_paddr
+ - (((S_IS_COMMON (fixP->fx_subsy) ? 0 : S_GET_VALUE (fixP->fx_subsy))
+ + segment_info[S_GET_SEGMENT (fixP->fx_subsy)].scnhdr.s_paddr)
+ << 1) /* (TIGCC 20030717) Yes, we need to subtract this twice!
+ This kludge compensates for later incorrect
+ computations in obj-coff.c. -- Kevin Kofler */,
+ 0, 0);
+ if (negreloc) {
+ fixP->fx_offset = 0; /* We have transferred the offset to the negative reloc. */
+ fixP->fx_pcrel = 0;
+ fixP->fx_subsy = NULL;
+ negreloc->fx_tcbit = 1;
+ /* turn off range checking for both relocs: */
+ fixP->fx_im_disp = negreloc->fx_im_disp = 1;
+ }
+#if 0
+ }
+#endif
+ }
+
+ /* (TIGCC 20030716) Moved this down so val can be adjusted. -- Kevin Kofler */
switch (fixP->fx_size)
{
/* The cast to offsetT below are necessary to make code
@@ -4669,13 +4788,8 @@
BAD_CASE (fixP->fx_size);
}
- /* Fix up a negative reloc. */
- if (fixP->fx_addsy == NULL && fixP->fx_subsy != NULL)
- {
- fixP->fx_addsy = fixP->fx_subsy;
- fixP->fx_subsy = NULL;
- fixP->fx_tcbit = 1;
- }
+ /* (TIGCC 20030716) Reuse fx_im_disp to turn off range checking. -- Kevin Kofler */
+ if (fixP->fx_im_disp) return;
/* For non-pc-relative values, it's conceivable we might get something
like "0xff" for a byte field. So extend the upper part of the range
@@ -4684,7 +4798,17 @@
if (! fixP->fx_pcrel && ! fixP->fx_signed)
upper_limit = upper_limit * 2 + 1;
- if ((addressT) val > upper_limit
+ /* (TIGCC 20050507) We can't properly range-check PC-relative relocs in
+ all-relocs mode because of COFF VMA annoyances. Ideally, the section
+ contents should be just unrelocated offsets which can be properly
+ range-checked, but unfortunately COFF is designed with unrelocated use in
+ mind and relocation as an afterthought. And moreover, we need to
+ range-check in the linker anyway, as only the linker knows the final
+ section disposition. So let's just let the linker worry about
+ range-checking. */
+ if (fixP->fx_pcrel)
+ fixP->fx_im_disp = 1;
+ else if ((addressT) val > upper_limit
&& (val > 0 || val < lower_limit))
as_bad_where (fixP->fx_file, fixP->fx_line, _("value out of range"));
@@ -4795,6 +4919,27 @@
fragP->fr_opcode[0] ^= 0x01; /* Invert bcc. */
fragP->fr_opcode[1] = 0x06; /* Branch offset = 6. */
+ /* (TIGCC 20030902) Add a PC-relative reloc (unconditionally, because
+ it will be removed later on if not in all-relocs
+ mode). -- Kevin Kofler
+ (TIGCC 20030908) Unfortunately, we cannot create symbols here for some
+ reason, so we create the symbol in advance in
+ md_estimate_size_before_relax and store it into the
+ frag structure of the next frag. Here, we only have to
+ read it. -- Kevin Kofler, patch by Sebastian Reichelt
+ */
+ {
+ fragS *nextFragP = fragP->fr_next;
+ symbolS *symbolP = NULL;
+ if (nextFragP)
+ symbolP = nextFragP->fr_start_symbol;
+
+ if (symbolP)
+ fix_new (fragP, fragP->fr_fix - 1, 1, symbolP, -1, 1, RELAX_RELOC_PC8);
+ else
+ as_warn_where (fragP->fr_file, fragP->fr_line, _("no symbol available for pseudo-op code"));
+ }
+
/* JF: these used to be fr_opcode[2,3], but they may be in a
different frag, in which case referring to them is a no-no.
Only fr_opcode[0,1] are guaranteed to work. */
@@ -4963,8 +5108,17 @@
&& relaxable_symbol (fragP->fr_symbol))
{
fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), BYTE);
+ /* (TIGCC 20030909) Create a symbol at the beginning of the next frag
+ and store it into the frag structure, because
+ md_convert_frag_1 might need a symbol there, but
+ can't create it itself. This is necessary only for
+ conditional jumps. -- Kevin Kofler */
+ if ((TABTYPE (fragP->fr_subtype) == BRABSJCOND) && fragP->fr_next)
+ {
+ fragP->fr_next->fr_start_symbol = symbol_new (FAKE_LABEL_NAME, segment, fragP->fr_next->fr_address, fragP->fr_next);
+ }
}
- else if (flag_short_refs)
+ else if (flag_short_jumps)
{
/* Symbol is undefined and we want short ref. */
fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
@@ -4973,6 +5127,17 @@
{
/* Symbol is still undefined. Make it LONG. */
fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), LONG);
+ /* (TIGCC 20030908) Create a symbol at the beginning of the next frag
+ and store it into the frag structure, because
+ md_convert_frag_1 might need a symbol there, but
+ can't create it itself.
+ -- Kevin Kofler, patch by Sebastian Reichelt
+ (TIGCC 20030909) This is necessary only for conditional jumps.
+ -- Kevin Kofler */
+ if ((TABTYPE (fragP->fr_subtype) == BRABSJCOND) && fragP->fr_next)
+ {
+ fragP->fr_next->fr_start_symbol = symbol_new (FAKE_LABEL_NAME, segment, fragP->fr_next->fr_address, fragP->fr_next);
+ }
}
break;
}
@@ -4999,7 +5164,7 @@
{
if ((S_GET_SEGMENT (fragP->fr_symbol) == segment
&& relaxable_symbol (fragP->fr_symbol))
- || flag_short_refs)
+ || flag_short_jumps)
{
fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
}
@@ -5025,7 +5190,8 @@
case TAB (ABSTOPCREL, SZ_UNDEF):
{
if ((S_GET_SEGMENT (fragP->fr_symbol) == segment
- && relaxable_symbol (fragP->fr_symbol)))
+ && relaxable_symbol (fragP->fr_symbol))
+ || flag_short_refs)
{
fragP->fr_subtype = TAB (ABSTOPCREL, SHORT);
}
@@ -5069,6 +5235,7 @@
}
}
break;
+
default:
break;
}
@@ -5292,7 +5459,7 @@
subs (exp) = 0;
offs (exp) = (ok == 10) ? 1 : 0;
as_warn (_("Can't deal with expression; defaulting to %ld"),
- offs (exp));
+ (long) offs (exp));
}
}
else
@@ -5304,7 +5471,7 @@
subs (exp) = 0;
offs (exp) = (ok == 10) ? 1 : 0;
as_warn (_("Can't deal with expression; defaulting to %ld"),
- offs (exp));
+ (long) offs (exp));
}
}
@@ -7067,6 +7234,8 @@
{"disp-size-default-32", no_argument, NULL, OPTION_DISP_SIZE_DEFAULT_32},
#define OPTION_PCREL (OPTION_MD_BASE + 7)
{"pcrel", no_argument, NULL, OPTION_PCREL},
+#define OPTION_SHORT_JUMPS (OPTION_MD_BASE + 8)
+ {"short-jumps", no_argument, NULL, OPTION_SHORT_JUMPS},
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
@@ -7079,6 +7248,12 @@
case 'l': /* -l means keep external to 2 bit offset
rather than 16 bit one. */
flag_short_refs = 1;
+ flag_short_jumps = 1;
+ break;
+
+ case OPTION_SHORT_JUMPS: /* --short-jumps is like -l only for
+ jumps. */
+ flag_short_jumps = 1;
break;
case 'S': /* -S means that jbsr's always turn into
@@ -7255,6 +7430,7 @@
fprintf (stream, _("\
680X0 options:\n\
-l use 1 word for refs to undefined symbols [default 2]\n\
+--short-jumps use 1 word for jumps 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 | -m521x | -m5249 |\n\
diff -Naur binutils-2.16.1.orig/gas/config/tc-m68k.h binutils-2.16.1-src/gas/config/tc-m68k.h
--- binutils-2.16.1.orig/gas/config/tc-m68k.h 2005-03-01 23:35:20.000000000 +0100
+++ binutils-2.16.1-src/gas/config/tc-m68k.h 2005-07-01 00:40:16.000000000 +0200
@@ -234,3 +234,20 @@
#define tc_cfi_frame_initial_instructions tc_m68k_frame_initial_instructions
extern void tc_m68k_frame_initial_instructions (void);
+
+/* (TIGCC 20030716) Allow difference of undefined symbols. -- Kevin Kofler */
+#define UNDEFINED_DIFFERENCE_OK
+
+/* (TIGCC 20030716) Force relocs in all-relocs mode. -- Kevin Kofler */
+#define TC_FORCE_RELOCATION(FIX) \
+ (generic_force_reloc (FIX))
+#define TC_FORCE_RELOCATION_ABS(FIX) \
+ (0)
+#define TC_FORCE_RELOCATION_LOCAL(FIX) \
+ (TC_FORCE_RELOCATION (FIX))
+#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
+ (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))
+#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX) \
+ (TC_FORCE_RELOCATION (FIX))
+/* (END TIGCC 20030716) */
+
diff -Naur binutils-2.16.1.orig/gas/configure binutils-2.16.1-src/gas/configure
--- binutils-2.16.1.orig/gas/configure 2005-03-01 01:43:50.000000000 +0100
+++ binutils-2.16.1-src/gas/configure 2005-07-01 00:40:16.000000000 +0200
@@ -10839,7 +10839,7 @@
- ac_config_files="$ac_config_files Makefile doc/Makefile po/Makefile.in:po/Make-in"
+ ac_config_files="$ac_config_files Makefile"
ac_config_commands="$ac_config_commands default"
diff -Naur binutils-2.16.1.orig/gas/dwarf2dbg.c binutils-2.16.1-src/gas/dwarf2dbg.c
--- binutils-2.16.1.orig/gas/dwarf2dbg.c 2005-03-03 02:29:52.000000000 +0100
+++ binutils-2.16.1-src/gas/dwarf2dbg.c 2005-07-01 00:40:16.000000000 +0200
@@ -53,7 +53,15 @@
# define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8)
#endif
-#ifdef BFD_ASSEMBLER
+#ifndef BFD_ASSEMBLER
+# define section_symbol(SEC) seg_info(SEC)->dwarf2_secsym
+#endif
+
+#ifdef __MINGW32__
+# define ffs __builtin_ffs
+#endif
+
+#if 1 /*def BFD_ASSEMBLER*/
#include "subsegs.h"
@@ -331,6 +339,13 @@
dwarf2_gen_line_info (frag_now_fix () - size, &loc);
}
+void
+dwarf2_emit_insn_if_loc_seen (int size)
+{
+ if (loc_directive_seen)
+ dwarf2_emit_insn (size);
+}
+
/* Get a .debug_line file number for FILENAME. If NUM is nonzero,
allocate it on that file table slot, otherwise return the first
empty one. */
@@ -962,7 +977,9 @@
if (1 /* line != e->loc.line || changed */)
{
int line_delta = e->loc.line - line;
- if (frag == NULL)
+ /* (TIGCC 20050415) Always use DW_LNE_set_address, as everything else is
+ incompatible with linker optimization. -- Kevin Kofler */
+ if (1 /*frag == NULL*/)
{
out_set_addr (seg, e->frag, e->frag_ofs);
out_inc_line_addr (line_delta, 0);
@@ -992,11 +1009,16 @@
/* Emit a DW_LNE_end_sequence for the end of the section. */
last_frag = last_frag_for_seg (seg);
last_frag_ofs = get_frag_fix (last_frag);
+#if 0 /* (TIGCC 20050419) */
if (frag == last_frag)
out_inc_line_addr (INT_MAX, last_frag_ofs - frag_ofs);
else
relax_inc_line_addr (INT_MAX, seg, last_frag, last_frag_ofs,
frag, frag_ofs);
+#else
+ out_set_addr (seg, last_frag, last_frag_ofs);