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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
|
From a2105dfa9d60aa65e72b39d676031f5ebfe07ea3 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 01/27] Port bfd/config.bfd patch
---
bfd/config.bfd | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 9b719d8..2916bf0 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -271,7 +271,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
- armeb-*-elf | arm*b-*-linux-*)
+ armeb-*-elf | arm*b-*-linux-* | armeb-*-openbsd* )
targ_defvec=bfd_elf32_bigarm_vec
targ_selvecs=bfd_elf32_littlearm_vec
;;
@@ -281,7 +281,7 @@ case "${targ}" in
;;
arm-*-elf | arm-*-freebsd* | arm*-*-linux-* | arm*-*-conix* | \
arm*-*-uclinux* | arm-*-kfreebsd*-gnu | \
- arm*-*-eabi* )
+ arm*-*-eabi* | arm-*-openbsd* )
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
@@ -443,6 +443,10 @@ case "${targ}" in
;;
#ifdef BFD64
+ hppa64*-*-openbsd*)
+ targ_defvec=bfd_elf64_hppa_vec
+ targ_selfvecs=bfd_elf64_hppa_linux_vec
+ ;;
hppa*64*-*-linux-*)
targ_defvec=bfd_elf64_hppa_linux_vec
targ_selvecs=bfd_elf64_hppa_vec
@@ -530,6 +534,10 @@ case "${targ}" in
targ_defvec=go32coff_vec
targ_selvecs="go32stubbedcoff_vec i386aout_vec"
;;
+ hppa64*-*-openbsd*)
+ targ_defvec=bfd_elf64_hppa_vec
+ targ_selfvecs=bfd_elf64_hppa_linux_vec
+ ;;
i[3-7]86-*-sysv* | i[3-7]86-*-isc* | i[3-7]86-*-sco* | i[3-7]86-*-coff | \
i[3-7]86-*-aix*)
targ_defvec=i386coff_vec
@@ -622,11 +630,16 @@ case "${targ}" in
targ_selvecs="bfd_elf32_i386_freebsd_vec i386coff_vec i386pei_vec x86_64pei_vec bfd_elf32_i386_vec bfd_elf64_x86_64_vec bfd_elf64_l1om_vec bfd_elf64_l1om_freebsd_vec"
want64=true
;;
- x86_64-*-netbsd* | x86_64-*-openbsd*)
+ x86_64-*-netbsd*)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec i386pei_vec x86_64pei_vec bfd_elf64_l1om_vec"
want64=true
;;
+ x86_64-*-openbsd*)
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selfvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec"
+ want64=true
+ ;;
x86_64-*-linux-*)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386linux_vec i386pei_vec x86_64pei_vec bfd_elf64_l1om_vec"
@@ -1043,7 +1056,7 @@ case "${targ}" in
targ_defvec=pc532machaout_vec
targ_underscore=yes
;;
- ns32k-*-netbsd* | ns32k-*-lites* | ns32k-*-openbsd*)
+ ns32k-*-netbsd* | ns32k-*-lites*)
targ_defvec=pc532netbsd_vec
targ_underscore=yes
;;
@@ -1300,7 +1313,10 @@ case "${targ}" in
targ_selvecs="shlcoff_vec shlcoff_small_vec"
targ_underscore=yes
;;
-
+ sh*-*-openbsd*)
+ targ_defvec=bfd_elf32_shlobsd_vec
+ targ_selvecs="bfd_elf32_shobsd_vec"
+ ;;
#ifdef BFD64
shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf* | shl*-*-kaos*)
targ_defvec=bfd_elf32_shl_vec
From c5b873b76f42263fc8cdadfa4e75ed2f15ef2c28 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 01/26] Port bfd/configure.in patch
---
bfd/configure.in | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/bfd/configure.in b/bfd/configure.in
index fce1dd7..e57d832 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -779,8 +779,10 @@ do
bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shlobsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_shlvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shobsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_shvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_sparc_sol2_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;;
From bf789c2ba2a436c7e8dc0a8ff4e34bc28af15e2b Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 09/26] Port bfd/dlltool.c and bfd/dllwrap.c patch
---
binutils/dlltool.c | 4 ++++
binutils/dllwrap.c | 22 ++++++++++------------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 8c72647..1d266ed 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -1297,7 +1297,11 @@ run (const char *what, char *args)
int i;
const char **argv;
char *errmsg_fmt, *errmsg_arg;
+#if defined(__MSDOS__) && !defined(__GO32__)
char *temp_base = choose_temp_base ();
+#else
+ char *temp_base = NULL;
+#endif
inform ("run: %s %s", what, args);
diff --git a/binutils/dllwrap.c b/binutils/dllwrap.c
index 4e48f3e..f121d51 100644
--- a/binutils/dllwrap.c
+++ b/binutils/dllwrap.c
@@ -358,7 +358,11 @@ run (const char *what, char *args)
int i;
const char **argv;
char *errmsg_fmt, *errmsg_arg;
+#if defined(__MSDOS__) && !defined(__GO32__)
char *temp_base = choose_temp_base ();
+#else
+ char *temp_base = NULL;
+#endif
int in_quote;
char sep;
@@ -823,13 +827,9 @@ main (int argc, char **argv)
if (! def_file_seen)
{
- char *fileprefix = choose_temp_base ();
-
- def_file_name = (char *) xmalloc (strlen (fileprefix) + 5);
- sprintf (def_file_name, "%s.def",
- (dontdeltemps) ? mybasename (fileprefix) : fileprefix);
- delete_def_file = 1;
- free (fileprefix);
+ def_file_name = make_temp_file (".def");
+ if (dontdeltemps)
+ def_file_name = mybasename (def_file_name);
delete_def_file = 1;
warn (_("no export definition file provided.\n\
Creating one, but that may not be what you want"));
@@ -1036,12 +1036,10 @@ Creating one, but that may not be what you want"));
if (! base_file_name)
{
- char *fileprefix = choose_temp_base ();
- base_file_name = (char *) xmalloc (strlen (fileprefix) + 6);
- sprintf (base_file_name, "%s.base",
- (dontdeltemps) ? mybasename (fileprefix) : fileprefix);
+ base_file_name = make_temp_file (".base");
+ if (dontdeltemps)
+ base_file_name = mybasename (base_file_name);
delete_base_file = 1;
- free (fileprefix);
}
{
From 9ec7febe77cbd6b0420d976de07b96eadd9345d1 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 02/26] Port bfd/elf32-sh.c patch
---
bfd/elf32-sh.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index e15f51c..23c9457 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -7629,6 +7629,24 @@ sh_elf_encode_eh_address (bfd *abfd,
#include "elf32-target.h"
+/* OpenBSD support. */
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_shobsd_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-sh-obsd"
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_shlobsd_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-shl-obsd"
+#undef ELF_MAXPAGESIZE
+#define ELF_MAXPAGESIZE 0x10000
+#undef elf_symbol_leading_char
+#define elf_symbol_leading_char 0
+#undef elf32_bed
+#define elf32_bed elf32_sh_obsd_bed
+
+#include "elf32-target.h"
+
/* NetBSD support. */
#undef TARGET_BIG_SYM
#define TARGET_BIG_SYM bfd_elf32_shnbsd_vec
From 3cc9fdc96ec097a5dfab1224ca054cf7fd551257 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 03/26] Port bfd/elf.c patch
---
bfd/elf.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/bfd/elf.c b/bfd/elf.c
index 4f326a7..d7afa6c 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3489,9 +3489,12 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info)
asection *s;
const struct elf_backend_data *bed;
- /* Assume we will need exactly two PT_LOAD segments: one for text
- and one for data. */
- segs = 2;
+ /* We used to assume that two PT_LOAD segments would be enough,
+ code and data, with the change to pad the PLT and GOT, this is no
+ longer true. Now there can be several PT_LOAD sections. 7 seems
+ to be enough with BSS_PLT and .rodata-X, where we have text, data,
+ GOT, dynamic, PLT, bss */
+ segs = 7;
s = bfd_get_section_by_name (abfd, ".interp");
if (s != NULL && (s->flags & SEC_LOAD) != 0)
From 0b42b2ac300a254c01e270d44817de9c08ee6552 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 05/26] Port bfd/elfxx-mips.c patch
---
bfd/elfxx-mips.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 4718dd4..0b3c591 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -10374,11 +10374,16 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
decided not to make. This is for the n64 irix rld,
which doesn't seem to apply any relocations if there
are trailing null entries. */
- s = mips_elf_rel_dyn_section (info, FALSE);
- dyn.d_un.d_val = (s->reloc_count
+ if (SGI_COMPAT (output_bfd))
+ {
+ s = mips_elf_rel_dyn_section (dynobj, FALSE);
+ dyn.d_un.d_val = (s->reloc_count
* (ABI_64_P (output_bfd)
? sizeof (Elf64_Mips_External_Rel)
: sizeof (Elf32_External_Rel)));
+ }
+ else
+ swap_out_p = FALSE;
/* Adjust the section size too. Tools like the prelinker
can reasonably expect the values to the same. */
elf_section_data (s->output_section)->this_hdr.sh_size
From 95b0858781c6c371f3d53a4b0303c3a6dd45efe0 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 06/26] Port bfd/m68kopenbsd.c patch
---
bfd/m68kopenbsd.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
create mode 100644 bfd/m68kopenbsd.c
diff --git a/bfd/m68kopenbsd.c b/bfd/m68kopenbsd.c
new file mode 100644
index 0000000..459d3b2
--- /dev/null
+++ b/bfd/m68kopenbsd.c
@@ -0,0 +1,33 @@
+/* BFD back-end for OpenBSD/m88k a.out binaries.
+ Copyright 2004 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define TARGET_IS_BIG_ENDIAN_P
+
+#define TARGET_PAGE_SIZE 4096
+
+#define DEFAULT_ARCH bfd_arch_m88k
+#define DEFAULT_MID M_88K_OPENBSD
+
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (m88kopenbsd_,OP)
+#define TARGETNAME "a.out-m88k-openbsd"
+
+#include "netbsd.h"
From 08d9089d8293e875a0f292a5c98d50a862c7d335 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 07/26] Port bfd/Makefile.am patch
---
bfd/Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index bf5dea4..39fcd8a 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -884,7 +884,7 @@ host-aout.lo: Makefile
aout-params.h: gen-aout
./gen-aout host > aout-params.h
gen-aout: $(srcdir)/gen-aout.c Makefile
- $(CC) -o gen-aout $(CFLAGS) $(LFLAGS) $(srcdir)/gen-aout.c
+ $(CC) -o gen-aout $(CSEARCH) $(CFLAGS) $(LFLAGS) $(srcdir)/gen-aout.c
$(BFD_H): stmp-bfd-h ; @true
From 4601313fe3212de5027223467cff767eefd45073 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 08/26] Port bfd/targets.c patch
---
bfd/targets.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/bfd/targets.c b/bfd/targets.c
index 3e99754..8ee779b 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -672,8 +672,10 @@ extern const bfd_target bfd_elf32_shl_vec;
extern const bfd_target bfd_elf32_shl_symbian_vec;
extern const bfd_target bfd_elf32_shlin_vec;
extern const bfd_target bfd_elf32_shlnbsd_vec;
+extern const bfd_target bfd_elf32_shlobsd_vec;
extern const bfd_target bfd_elf32_shlvxworks_vec;
extern const bfd_target bfd_elf32_shnbsd_vec;
+extern const bfd_target bfd_elf32_shobsd_vec;
extern const bfd_target bfd_elf32_shvxworks_vec;
extern const bfd_target bfd_elf32_sparc_vec;
extern const bfd_target bfd_elf32_sparc_sol2_vec;
@@ -1015,8 +1017,10 @@ static const bfd_target * const _bfd_target_vector[] =
&bfd_elf32_shl_symbian_vec,
&bfd_elf32_shlin_vec,
&bfd_elf32_shlnbsd_vec,
+ &bfd_elf32_shlobsd_vec,
&bfd_elf32_shlvxworks_vec,
&bfd_elf32_shnbsd_vec,
+ &bfd_elf32_shobsd_vec,
&bfd_elf32_shvxworks_vec,
#ifdef BFD64
&bfd_elf32_sh64_vec,
From 049390e058a46a6b4052ec37dc3a9b927ef39382 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 10/26] Port bfd/dlltool.c and binutils/Makefile.am patch
---
binutils/Makefile.am | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 0978538..d3c7ec6 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -48,7 +48,7 @@ OBJDUMP_PROG=objdump
# This is the demangler, as a standalone program.
# Note: This one is used as the installed name too, unlike the above.
-DEMANGLER_PROG=cxxfilt
+#DEMANGLER_PROG=cxxfilt
ADDR2LINE_PROG=addr2line
@@ -60,17 +60,18 @@ DLLWRAP_PROG=dllwrap
SRCONV_PROG=srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT)
-bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ @BUILD_WINDMC@ $(ADDR2LINE_PROG) $(READELF_PROG) $(ELFEDIT_PROG) @BUILD_DLLWRAP@ @BUILD_INSTALL_MISC@
+bin_PROGRAMS = $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ @BUILD_WINDMC@ $(ADDR2LINE_PROG) $(READELF_PROG) $(ELFEDIT_PROG) @BUILD_DLLWRAP@ @BUILD_INSTALL_MISC@
## We need a special rule to install the programs which are built with
## -new, and to rename cxxfilt to c++filt.
-RENAMED_PROGS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
+#RENAMED_PROGS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG)
+RENAMED_PROGS = $(STRIP_PROGS)
noinst_PROGRAMS = $(RENAMED_PROGS) @BUILD_MISC@
EXTRA_PROGRAMS = $(NLMCONV_PROG) srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(WINDMC_PROG) $(DLLWRAP_PROG)
# Stuff that goes in tooldir/ if appropriate.
-TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump objcopy
+TOOL_PROGS = strip-new ar ranlib dlltool objdump objcopy
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
@@ -217,7 +218,7 @@ endif
$(COMPILE) -c $(OBJDUMP_DEFS) $(srcdir)/objdump.c
endif
-cxxfilt_SOURCES = cxxfilt.c $(BULIBS)
+#cxxfilt_SOURCES = cxxfilt.c $(BULIBS)
ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c binemul.c \
emul_$(EMULATION).c $(BULIBS)
From 70447029f77c30e293997db95f6cc622d4182e45 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 11/26] Port bfd/dlltool.c and binutils/rdbg.c patch
---
binutils/rddbg.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/binutils/rddbg.c b/binutils/rddbg.c
index 27abd66..c91ead7 100644
--- a/binutils/rddbg.c
+++ b/binutils/rddbg.c
@@ -199,7 +199,7 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount,
s = (char *) strings + stroff + strx;
- while (s[strlen (s) - 1] == '\\'
+ while (*s != '\0' && s[strlen (s) - 1] == '\\'
&& stab + 12 < stabs + stabsize)
{
char *p;
From 5f87ad14c028aad0539f20f42bf2264b7c84a6b4 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 12/26] Port bfd/dlltool.c and binutils/stabs.c patch
---
binutils/resrc.c | 11 +-
binutils/stabs.c | 350 ------------------------------------------------------
2 files changed, 8 insertions(+), 353 deletions(-)
diff --git a/binutils/resrc.c b/binutils/resrc.c
index a72a23f..ff99c65 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -207,7 +207,11 @@ run_cmd (char *cmd, const char *redir)
int i;
const char **argv;
char *errmsg_fmt, *errmsg_arg;
+#if defined(__MSDOS__) && !defined(__GO32__)
char *temp_base = choose_temp_base ();
+#else
+ char *temp_base = NULL;
+#endif
int in_quote;
char sep;
int redir_handle = -1;
@@ -318,12 +322,7 @@ open_input_stream (char *cmd)
{
if (istream_type == ISTREAM_FILE)
{
- char *fileprefix;
-
- fileprefix = choose_temp_base ();
- cpp_temp_file = (char *) xmalloc (strlen (fileprefix) + 5);
- sprintf (cpp_temp_file, "%s.irc", fileprefix);
- free (fileprefix);
+ cpp_temp_file = make_temp_file (".irc");
if (run_cmd (cmd, cpp_temp_file))
fatal (_("can't execute `%s': %s"), cmd, strerror (errno));
diff --git a/binutils/stabs.c b/binutils/stabs.c
index f8fb48c..293dbfc 100644
--- a/binutils/stabs.c
+++ b/binutils/stabs.c
@@ -199,13 +199,13 @@ static debug_type stab_find_tagged_type
(void *, struct stab_handle *, const char *, int, enum debug_type_kind);
static debug_type *stab_demangle_argtypes
(void *, struct stab_handle *, const char *, bfd_boolean *, unsigned int);
-static debug_type *stab_demangle_v3_argtypes
+/*static debug_type *stab_demangle_v3_argtypes
(void *, struct stab_handle *, const char *, bfd_boolean *);
static debug_type *stab_demangle_v3_arglist
(void *, struct stab_handle *, struct demangle_component *, bfd_boolean *);
static debug_type stab_demangle_v3_arg
(void *, struct stab_handle *, struct demangle_component *, debug_type,
- bfd_boolean *);
+ bfd_boolean *);*/
/* Save a string in memory. */
@@ -2829,7 +2829,6 @@ parse_stab_argtypes (void *dhandle, struct stab_handle *info,
bfd_boolean is_full_physname_constructor;
bfd_boolean is_constructor;
bfd_boolean is_destructor;
- bfd_boolean is_v3;
debug_type *args;
bfd_boolean varargs;
unsigned int physname_len = 0;
@@ -2849,9 +2848,8 @@ parse_stab_argtypes (void *dhandle, struct stab_handle *info,
&& (argtypes[1] == '$' || argtypes[1] == '.')
&& argtypes[2] == '_')
|| CONST_STRNEQ (argtypes, "__dt"));
- is_v3 = argtypes[0] == '_' && argtypes[1] == 'Z';
- if (is_destructor || is_full_physname_constructor || is_v3)
+ if (is_destructor || is_full_physname_constructor)
*pphysname = argtypes;
else
{
@@ -3714,10 +3712,6 @@ stab_demangle_argtypes (void *dhandle, struct stab_handle *info,
{
struct stab_demangle_info minfo;
- /* Check for the g++ V3 ABI. */
- if (physname[0] == '_' && physname[1] == 'Z')
- return stab_demangle_v3_argtypes (dhandle, info, physname, pvarargs);
-
minfo.dhandle = dhandle;
minfo.info = info;
minfo.args = NULL;
@@ -5060,341 +5054,3 @@ stab_demangle_remember_type (struct stab_demangle_info *minfo,
return TRUE;
}
-
-/* Demangle names encoded using the g++ V3 ABI. The newer versions of
- g++ which use this ABI do not encode ordinary method argument types
- in a mangled name; they simply output the argument types. However,
- for a static method, g++ simply outputs the return type and the
- physical name. So in that case we need to demangle the name here.
- Here PHYSNAME is the physical name of the function, and we set the
- variable pointed at by PVARARGS to indicate whether this function
- is varargs. This returns NULL, or a NULL terminated array of
- argument types. */
-
-static debug_type *
-stab_demangle_v3_argtypes (void *dhandle, struct stab_handle *info,
- const char *physname, bfd_boolean *pvarargs)
-{
- struct demangle_component *dc;
- void *mem;
- debug_type *pargs;
-
- dc = cplus_demangle_v3_components (physname, DMGL_PARAMS | DMGL_ANSI, &mem);
- if (dc == NULL)
- {
- stab_bad_demangle (physname);
- return NULL;
- }
-
- /* We expect to see TYPED_NAME, and the right subtree describes the
- function type. */
- if (dc->type != DEMANGLE_COMPONENT_TYPED_NAME
- || dc->u.s_binary.right->type != DEMANGLE_COMPONENT_FUNCTION_TYPE)
- {
- fprintf (stderr, _("Demangled name is not a function\n"));
- free (mem);
- return NULL;
- }
-
- pargs = stab_demangle_v3_arglist (dhandle, info,
- dc->u.s_binary.right->u.s_binary.right,
- pvarargs);
-
- free (mem);
-
- return pargs;
-}
-
-/* Demangle an argument list in a struct demangle_component tree.
- Returns a DEBUG_TYPE_NULL terminated array of argument types, and
- sets *PVARARGS to indicate whether this is a varargs function. */
-
-static debug_type *
-stab_demangle_v3_arglist (void *dhandle, struct stab_handle *info,
- struct demangle_component *arglist,
- bfd_boolean *pvarargs)
-{
- struct demangle_component *dc;
- unsigned int alloc, count;
- debug_type *pargs;
-
- alloc = 10;
- pargs = (debug_type *) xmalloc (alloc * sizeof *pargs);
- *pvarargs = FALSE;
-
- count = 0;
-
- for (dc = arglist;
- dc != NULL;
- dc = dc->u.s_binary.right)
- {
- debug_type arg;
- bfd_boolean varargs;
-
- if (dc->type != DEMANGLE_COMPONENT_ARGLIST)
- {
- fprintf (stderr, _("Unexpected type in v3 arglist demangling\n"));
- free (pargs);
- return NULL;
- }
-
- arg = stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.left,
- NULL, &varargs);
- if (arg == NULL)
- {
- if (varargs)
- {
- *pvarargs = TRUE;
- continue;
- }
- free (pargs);
- return NULL;
- }
-
- if (count + 1 >= alloc)
- {
- alloc += 10;
- pargs = (debug_type *) xrealloc (pargs, alloc * sizeof *pargs);
- }
-
- pargs[count] = arg;
- ++count;
- }
-
- pargs[count] = DEBUG_TYPE_NULL;
-
- return pargs;
-}
-
-/* Convert a struct demangle_component tree describing an argument
- type into a debug_type. */
-
-static debug_type
-stab_demangle_v3_arg (void *dhandle, struct stab_handle *info,
- struct demangle_component *dc, debug_type context,
- bfd_boolean *pvarargs)
-{
- debug_type dt;
-
- if (pvarargs != NULL)
- *pvarargs = FALSE;
-
- switch (dc->type)
- {
- /* FIXME: These are demangle component types which we probably
- need to handle one way or another. */
- case DEMANGLE_COMPONENT_LOCAL_NAME:
- case DEMANGLE_COMPONENT_TYPED_NAME:
- case DEMANGLE_COMPONENT_TEMPLATE_PARAM:
- case DEMANGLE_COMPONENT_CTOR:
- case DEMANGLE_COMPONENT_DTOR:
- case DEMANGLE_COMPONENT_JAVA_CLASS:
- case DEMANGLE_COMPONENT_RESTRICT_THIS:
- case DEMANGLE_COMPONENT_VOLATILE_THIS:
- case DEMANGLE_COMPONENT_CONST_THIS:
- case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
- case DEMANGLE_COMPONENT_COMPLEX:
- case DEMANGLE_COMPONENT_IMAGINARY:
- case DEMANGLE_COMPONENT_VENDOR_TYPE:
- case DEMANGLE_COMPONENT_ARRAY_TYPE:
- case DEMANGLE_COMPONENT_PTRMEM_TYPE:
- case DEMANGLE_COMPONENT_ARGLIST:
- default:
- fprintf (stderr, _("Unrecognized demangle component %d\n"),
- (int) dc->type);
- return NULL;
-
- case DEMANGLE_COMPONENT_NAME:
- if (context != NULL)
- {
- const debug_field *fields;
-
- fields = debug_get_fields (dhandle, context);
- if (fields != NULL)
- {
- /* Try to find this type by looking through the context
- class. */
- for (; *fields != DEBUG_FIELD_NULL; fields++)
- {
- debug_type ft;
- const char *dn;
-
- ft = debug_get_field_type (dhandle, *fields);
- if (ft == NULL)
- return NULL;
- dn = debug_get_type_name (dhandle, ft);
- if (dn != NULL
- && (int) strlen (dn) == dc->u.s_name.len
- && strncmp (dn, dc->u.s_name.s, dc->u.s_name.len) == 0)
- return ft;
- }
- }
- }
- return stab_find_tagged_type (dhandle, info, dc->u.s_name.s,
- dc->u.s_name.len, DEBUG_KIND_ILLEGAL);
-
- case DEMANGLE_COMPONENT_QUAL_NAME:
- context = stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.left,
- context, NULL);
- if (context == NULL)
- return NULL;
- return stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.right,
- context, NULL);
-
- case DEMANGLE_COMPONENT_TEMPLATE:
- {
- char *p;
- size_t alc;
-
- /* We print this component to get a class name which we can
- use. FIXME: This probably won't work if the template uses
- template parameters which refer to an outer template. */
- p = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, dc, 20, &alc);
- if (p == NULL)
- {
- fprintf (stderr, _("Failed to print demangled template\n"));
- return NULL;
- }
- dt = stab_find_tagged_type (dhandle, info, p, strlen (p),
- DEBUG_KIND_CLASS);
- free (p);
- return dt;
- }
-
- case DEMANGLE_COMPONENT_SUB_STD:
- return stab_find_tagged_type (dhandle, info, dc->u.s_string.string,
- dc->u.s_string.len, DEBUG_KIND_ILLEGAL);
-
- case DEMANGLE_COMPONENT_RESTRICT:
- case DEMANGLE_COMPONENT_VOLATILE:
- case DEMANGLE_COMPONENT_CONST:
- case DEMANGLE_COMPONENT_POINTER:
- case DEMANGLE_COMPONENT_REFERENCE:
- dt = stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.left, NULL,
- NULL);
- if (dt == NULL)
- return NULL;
-
- switch (dc->type)
- {
- default:
- abort ();
- case DEMANGLE_COMPONENT_RESTRICT:
- /* FIXME: We have no way to represent restrict. */
- return dt;
- case DEMANGLE_COMPONENT_VOLATILE:
- return debug_make_volatile_type (dhandle, dt);
- case DEMANGLE_COMPONENT_CONST:
- return debug_make_const_type (dhandle, dt);
- case DEMANGLE_COMPONENT_POINTER:
- return debug_make_pointer_type (dhandle, dt);
- case DEMANGLE_COMPONENT_REFERENCE:
- return debug_make_reference_type (dhandle, dt);
- }
-
- case DEMANGLE_COMPONENT_FUNCTION_TYPE:
- {
- debug_type *pargs;
- bfd_boolean varargs;
-
- if (dc->u.s_binary.left == NULL)
- {
- /* In this case the return type is actually unknown.
- However, I'm not sure this will ever arise in practice;
- normally an unknown return type would only appear at
- the top level, which is handled above. */
- dt = debug_make_void_type (dhandle);
- }
- else
- dt = stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.left, NULL,
- NULL);
- if (dt == NULL)
- return NULL;
-
- pargs = stab_demangle_v3_arglist (dhandle, info,
- dc->u.s_binary.right,
- &varargs);
- if (pargs == NULL)
- return NULL;
-
- return debug_make_function_type (dhandle, dt, pargs, varargs);
- }
-
- case DEMANGLE_COMPONENT_BUILTIN_TYPE:
- {
- char *p;
- size_t alc;
- debug_type ret;
-
- /* We print this component in order to find out the type name.
- FIXME: Should we instead expose the
- demangle_builtin_type_info structure? */
- p = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, dc, 20, &alc);
- if (p == NULL)
- {
- fprintf (stderr, _("Couldn't get demangled builtin type\n"));
- return NULL;
- }
-
- /* The mangling is based on the type, but does not itself
- indicate what the sizes are. So we have to guess. */
- if (strcmp (p, "signed char") == 0)
- ret = debug_make_int_type (dhandle, 1, FALSE);
- else if (strcmp (p, "bool") == 0)
- ret = debug_make_bool_type (dhandle, 1);
- else if (strcmp (p, "char") == 0)
- ret = debug_make_int_type (dhandle, 1, FALSE);
- else if (strcmp (p, "double") == 0)
- ret = debug_make_float_type (dhandle, 8);
- else if (strcmp (p, "long double") == 0)
- ret = debug_make_float_type (dhandle, 8);
- else if (strcmp (p, "float") == 0)
- ret = debug_make_float_type (dhandle, 4);
- else if (strcmp (p, "__float128") == 0)
- ret = debug_make_float_type (dhandle, 16);
- else if (strcmp (p, "unsigned char") == 0)
- ret = debug_make_int_type (dhandle, 1, TRUE);
- else if (strcmp (p, "int") == 0)
- ret = debug_make_int_type (dhandle, 4, FALSE);
- else if (strcmp (p, "unsigned int") == 0)
- ret = debug_make_int_type (dhandle, 4, TRUE);
- else if (strcmp (p, "long") == 0)
- ret = debug_make_int_type (dhandle, 4, FALSE);
- else if (strcmp (p, "unsigned long") == 0)
- ret = debug_make_int_type (dhandle, 4, TRUE);
- else if (strcmp (p, "__int128") == 0)
- ret = debug_make_int_type (dhandle, 16, FALSE);
- else if (strcmp (p, "unsigned __int128") == 0)
- ret = debug_make_int_type (dhandle, 16, TRUE);
- else if (strcmp (p, "short") == 0)
- ret = debug_make_int_type (dhandle, 2, FALSE);
- else if (strcmp (p, "unsigned short") == 0)
- ret = debug_make_int_type (dhandle, 2, TRUE);
- else if (strcmp (p, "void") == 0)
- ret = debug_make_void_type (dhandle);
- else if (strcmp (p, "wchar_t") == 0)
- ret = debug_make_int_type (dhandle, 4, TRUE);
- else if (strcmp (p, "long long") == 0)
- ret = debug_make_int_type (dhandle, 8, FALSE);
- else if (strcmp (p, "unsigned long long") == 0)
- ret = debug_make_int_type (dhandle, 8, TRUE);
- else if (strcmp (p, "...") == 0)
- {
- if (pvarargs == NULL)
- fprintf (stderr, _("Unexpected demangled varargs\n"));
- else
- *pvarargs = TRUE;
- ret = NULL;
- }
- else
- {
- fprintf (stderr, _("Unrecognized demangled builtin type\n"));
- ret = NULL;
- }
-
- free (p);
-
- return ret;
- }
- }
-}
From 99bb30f56b48efed145d359ecfb119814d00e309 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 22/27] Port emulparams scripts
---
ld/emulparams/elf_i386_obsd.sh | 24 ++++++++++++++++++++++++
ld/emulparams/elf_obsd.sh | 8 ++++++++
ld/emulparams/elf_x86_64_obsd.sh | 2 ++
3 files changed, 34 insertions(+), 0 deletions(-)
create mode 100644 ld/emulparams/elf_i386_obsd.sh
create mode 100644 ld/emulparams/elf_obsd.sh
create mode 100644 ld/emulparams/elf_x86_64_obsd.sh
diff --git a/ld/emulparams/elf_i386_obsd.sh b/ld/emulparams/elf_i386_obsd.sh
new file mode 100644
index 0000000..ae7ba0e
--- /dev/null
+++ b/ld/emulparams/elf_i386_obsd.sh
@@ -0,0 +1,24 @@
+. ${srcdir}/emulparams/elf_i386.sh
+. ${srcdir}/emulparams/elf_obsd.sh
+
+if test "${LD_FLAG#"${LD_FLAG%pie}"}" = "pie"; then
+ TEXT_START_ADDR=0x0
+ if test "${LD_FLAG%%(cpie|pie)}" = "Z"; then
+ RODATA_PADSIZE=${MAXPAGESIZE}
+ else
+ RODATA_PADSIZE=0x20000000
+ fi
+else
+ if test "${LD_FLAG%%(cpie|pie)}" = "Z"; then
+ TEXT_START_ADDR=0x08048000
+ RODATA_PADSIZE=${MAXPAGESIZE}
+ else
+ TEXT_START_ADDR=0x1C000000
+ RODATA_PADSIZE=0x20000000
+ fi
+fi
+
+RODATA_ALIGN=". = ALIGN(${RODATA_PADSIZE})"
+RODATA_ALIGN_ADD="${TEXT_START_ADDR}"
+
+unset PAD_PLT
diff --git a/ld/emulparams/elf_obsd.sh b/ld/emulparams/elf_obsd.sh
new file mode 100644
index 0000000..37e0d51
--- /dev/null
+++ b/ld/emulparams/elf_obsd.sh
@@ -0,0 +1,8 @@
+LIB_PATH=/usr/lib
+
+PAD_RO=
+RODATA_PADSIZE=${MAXPAGESIZE}
+RODATA_ALIGN=". = ALIGN(${RODATA_PADSIZE}) + (. & (${RODATA_PADSIZE} - 1))"
+PAD_GOT=
+PAD_PLT=
+DATA_START_SYMBOLS='__data_start = . ;'
diff --git a/ld/emulparams/elf_x86_64_obsd.sh b/ld/emulparams/elf_x86_64_obsd.sh
new file mode 100644
index 0000000..3689dad
--- /dev/null
+++ b/ld/emulparams/elf_x86_64_obsd.sh
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/elf_x86_64.sh
+. ${srcdir}/emulparams/elf_obsd.sh
From f8fc67d17104aaf6e331259439a5c8a520ac1684 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 13/26] Port gas cofig patches
---
gas/config/tc-arm.c | 4 ++--
gas/config/tc-i386.c | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index f4ebdc4..8acf362 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -108,7 +108,7 @@ enum arm_float_abi
#ifndef FPU_DEFAULT
# ifdef TE_LINUX
# define FPU_DEFAULT FPU_ARCH_FPA
-# elif defined (TE_NetBSD)
+# elif defined (TE_NetBSD) || defined (TE_OpenBSD)
# ifdef OBJ_ELF
# define FPU_DEFAULT FPU_ARCH_VFP /* Soft-float, but VFP order. */
# else
@@ -22052,7 +22052,7 @@ md_begin (void)
else if (!mfpu_opt)
{
#if !(defined (EABI_DEFAULT) || defined (TE_LINUX) \
- || defined (TE_NetBSD) || defined (TE_VXWORKS))
+ || defined (TE_NetBSD) || defined (TE_VXWORKS) || defined(TE_OpenBSD))
/* Some environments specify a default FPU. If they don't, infer it
from the processor. */
if (mcpu_fpu_opt)
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 9c33cf9..f59694f 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -303,7 +303,8 @@ const char extra_symbol_chars[] = "*%-(["
&& !defined (TE_LINUX) \
&& !defined (TE_NETWARE) \
&& !defined (TE_FreeBSD) \
- && !defined (TE_NetBSD)))
+ && !defined (TE_NetBSD) \
+ && !defined (TE_OpenBSD)))
/* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful. The option
--divide will remove '/' from this list. */
From 9a9948f66a8bd7806d93903b7c35eaa60be967d7 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 14/26] Port gas/Makefile.am patch
---
gas/Makefile.am | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/gas/Makefile.am b/gas/Makefile.am
index 7b897f3..9fc7afd 100644
--- a/gas/Makefile.am
+++ b/gas/Makefile.am
@@ -282,6 +282,7 @@ TARG_ENV_HFILES = \
config/te-macos.h \
config/te-nbsd.h \
config/te-nbsd532.h \
+ config/te-obsd.h \
config/te-netware.h \
config/te-pc532mach.h \
config/te-pe.h \
@@ -355,6 +356,7 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config \
# and the system's installed libraries.
GASLIBS = @OPCODES_LIB@ ../bfd/libbfd.la ../libiberty/libiberty.a
+GASLIBSDEPS = @OPCODES_LIB@ ../bfd/libbfd.la
# Files to be copied away after each stage in building.
STAGESTUFF = *.@OBJEXT@ $(noinst_PROGRAMS)
@@ -363,7 +365,7 @@ as_new_SOURCES = $(GAS_CFILES)
as_new_LDADD = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
$(extra_objects) $(GASLIBS) $(LIBINTL) $(LIBM)
as_new_DEPENDENCIES = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
- $(extra_objects) $(GASLIBS) $(LIBINTL_DEP)
+ $(extra_objects) $(GASLIBSDEPS) $(LIBINTL_DEP)
EXTRA_as_new_SOURCES = $(CFILES) $(HFILES) $(TARGET_CPU_CFILES) \
$(TARGET_CPU_HFILES) $(OBJ_FORMAT_CFILES) $(OBJ_FORMAT_HFILES) \
$(TARG_ENV_CFILES) $(CONFIG_ATOF_CFILES) $(MULTI_CFILES)
From 0f2df696592793712a16cae18bd5dac4c2d3a58e Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 15/26] Port gas/read.c patch
---
gas/read.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gas/read.c b/gas/read.c
index bd3fa58..a2f37bb 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -5336,7 +5336,7 @@ next_char_of_string (void)
int i;
for (i = 0, number = 0;
- ISDIGIT (c) && i < 3;
+ i < 3 && ISDIGIT (c);
c = *input_line_pointer++, i++)
{
number = number * 8 + c - '0';
From 1f312c52f16e177676ac82816412b336f8cd0bd7 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 17/26] Port ld/configure.tgt patch
---
ld/configure.tgt | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 4e90739..bff4c20 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -259,6 +259,14 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
| sed -e 's/x86_64/i386/'`
tdir_elf_i386=`echo ${targ_alias} \
| sed -e 's/x86_64/i386/'` ;;
+i[3-7]86-*-openbsd[0-2]* | i[3-7]86-*-openbsd3.[0-2])
+ targ_emul=i386obsd ;;
+i[3-7]86-*-openbsd*) targ_emul=elf_i386_obsd ;;
+x86_64-*-openbsd*) targ_emul=elf_x86_64_obsd
+ targ_extra_emuls="elf_i386_obsd elf_i386"
+ tdir_elf_i386_obsd=`echo ${targ_alias} | \
+ sed -e 's/x86_64/i386/'`
+ ;;
i[3-7]86-*-sysv*) targ_emul=i386coff ;;
i[3-7]86-*-ptx*) targ_emul=i386coff ;;
i[3-7]86-*-mach*) targ_emul=i386mach ;;
From b05d9772b29631845d033f12b09aacfc5edd8f73 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 21/27] Port ld/Makefile.am patch
---
ld/Makefile.am | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/ld/Makefile.am b/ld/Makefile.am
index b4364be..46dbba6 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -237,6 +237,7 @@ ALL_EMULATION_SOURCES = \
eelf_i386_be.c \
eelf_i386_chaos.c \
eelf_i386_fbsd.c \
+ eelf_i386_obsd.c \
eelf_i386_ldso.c \
eelf_i386_sol2.c \
eelf_i386_vxworks.c \
@@ -281,6 +282,7 @@ ALL_EMULATION_SOURCES = \
ei386nbsd.c \
ei386nto.c \
ei386nw.c \
+ ei386obsd.c \
ei386pe.c \
ei386pe_posix.c \
ei386pep.c \
@@ -443,6 +445,7 @@ ALL_64_EMULATION_SOURCES = \
eshlelf64_nbsd.c \
eelf_x86_64.c \
eelf_x86_64_fbsd.c \
+ eelf_x86_64_obsd.c \
eelf_x86_64_sol2.c \
eelf_l1om.c \
eelf_l1om_fbsd.c \
@@ -1183,6 +1186,10 @@ eelf_l1om_fbsd.c: $(srcdir)/emulparams/elf_l1om_fbsd.sh \
$(srcdir)/emulparams/elf_l1om.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_l1om_fbsd "$(tdir_elf_l1om_fbsd)"
+eelf_x86_64_obsd.c: $(srcdir)/emulparams/elf_x86_64_obsd.sh \
+ $(srcdir)/emulparams/elf_x86_64.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_x86_64_obsd "$(tdir_elf_x86_64_obsd)"
eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386_be "$(tdir_elf_i386_be)"
@@ -1193,6 +1200,10 @@ eelf_i386_fbsd.c: $(srcdir)/emulparams/elf_i386_fbsd.sh \
$(srcdir)/emulparams/elf_i386.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386_fbsd "$(tdir_elf_i386_fbsd)"
+eelf_i386_obsd.c: $(srcdir)/emulparams/elf_i386_obsd.sh \
+ $(srcdir)/emulparams/elf_i386.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_i386_obsd "$(tdir_elf_i386_obsd)"
eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)"
@@ -1342,6 +1353,9 @@ ei386nto.c: $(srcdir)/emulparams/i386nto.sh \
ei386nw.c: $(srcdir)/emulparams/i386nw.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS}
${GENSCRIPTS} i386nw "$(tdir_i386nw)"
+ei386obsd.c: $(srcdir)/emulparams/i386obsd.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} i386obsd "$(tdir_i386obsd)"
ei386pe.c: $(srcdir)/emulparams/i386pe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
${GENSCRIPTS} i386pe "$(tdir_i386pe)"
From fe7580454be658f3838f631c33b46c7f612c8371 Mon Sep 17 00:00:00 2001
From: Maxim <kolmax94@gmail.com>
Subject: [PATCH 27/27] Fix sentinels
---
ld/plugin.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ld/plugin.c b/ld/plugin.c
index 79b39e8..6107dbe 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -268,7 +268,7 @@ asymbol_from_plugin_symbol (bfd *abfd, asymbol *asym,
asym->the_bfd = abfd;
asym->name = ldsym->version
- ? concat (ldsym->name, "@", ldsym->version, NULL)
+ ? concat (ldsym->name, "@", ldsym->version, (char *) NULL)
: ldsym->name;
asym->value = 0;
switch (ldsym->def)
@@ -563,7 +563,7 @@ message (int level, const char *format, ...)
default:
{
char *newfmt = ACONCAT ((level == LDPL_FATAL ? "%F" : "%X",
- format, NULL));
+ format, (char *) NULL));
vfinfo (stderr, newfmt, args, TRUE);
}
break;
|