summary refs log tree commit diff stats
path: root/results/classifier/118/none/1791796
blob: ddd73146e5a917511cd44032e23eee8a24fb2b77 (plain) (blame)
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
user-level: 0.591
mistranslation: 0.575
risc-v: 0.563
register: 0.558
debug: 0.554
KVM: 0.548
permissions: 0.536
semantic: 0.535
VMM: 0.534
device: 0.531
PID: 0.527
peripherals: 0.524
graphic: 0.524
TCG: 0.523
hypervisor: 0.522
ppc: 0.520
network: 0.517
performance: 0.517
x86: 0.514
assembly: 0.514
vnc: 0.510
arm: 0.505
kernel: 0.500
architecture: 0.500
virtual: 0.495
socket: 0.481
files: 0.476
boot: 0.466
i386: 0.463

unimplemented thread syscalls in nios2 user-mode emulation

This bug is reported against the 3.0 release.

I noticed that the GCC test gcc.dg/torture/tls/tls-test.c is failing when run in user-mode qemu for nios2 target.  The problem appears to be that the thread-related syscalls are unimplemented in qemu.  Here is output from running with -strace:

22484 brk(NULL) = 0x00005000
22484 uname(0x7fffef5a) = 0
22484 faccessat(AT_FDCWD,"/etc/ld.so.preload",R_OK,0x5) = -1 errno=2 (No such file or directory)
22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./tls/libm.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 errno=2 (No such file or directory)
22484 fstatat64(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./tls",0x7fffe870,0) = -1 errno=2 (No such file or directory)
22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libm.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
22484 read(3,0x7fffe954,512) = 512
22484 fstat64(3,0x7fffe870) = 0
22484 mmap2(NULL,803596,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f716000
22484 mmap2(0x7f7d8000,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0xc1) = 0x7f7d8000
22484 close(3) = 0
22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libpthread.so.0",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
22484 read(3,0x7fffe948,512) = 512
22484 mmap2(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x7f714000
22484 fstat64(3,0x7fffe864) = 0
22484 mmap2(NULL,120700,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f6f6000
22484 mprotect(0x7f70e000,4096,PROT_NONE) = 0
22484 mmap2(0x7f70f000,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x18) = 0x7f70f000
22484 mmap2(0x7f712000,6012,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f712000
22484 close(3) = 0
22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libc.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
22484 read(3,0x7fffe93c,512) = 512
22484 fstat64(3,0x7fffe858) = 0
22484 mmap2(NULL,1491048,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f589000
22484 mmap2(0x7f6de000,86016,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x154) = 0x7f6de000
22484 mmap2(0x7f6f3000,8296,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f6f3000
22484 close(3) = 0
22484 mprotect(0x7f6de000,65536,PROT_READ) = 0
22484 mprotect(0x7f70f000,8192,PROT_READ) = 0
22484 mprotect(0x7f7d8000,4096,PROT_READ) = 0
22484 mprotect(0x00003000,4096,PROT_READ) = 0
22484 mprotect(0x7f7fc000,4096,PROT_READ) = 0
22484 set_tid_address(2138131700,2147480980,2147480988,2147480988,87148,47) = 22484
22484 set_robust_list(2138131708,12,2147480988,0,87148,47) = -1 errno=38 (Function not implemented)
22484 rt_sigaction(32,0x7ffff36c,NULL) = 0
22484 rt_sigaction(33,0x7ffff36c,NULL) = -1 errno=22 (Invalid argument)
22484 rt_sigprocmask(SIG_UNBLOCK,0x7ffff4a8,NULL) = 0
22484 getrlimit(3,2147480732,3,0,62512,47) = 0
22484 mmap2(NULL,8392704,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|0x20000,-1,0) = 0x7ed88000
22484 mprotect(0x7ed89000,8388608,PROT_READ|PROT_WRITE) = 0
22484 brk(NULL) = 0x00005000
22484 brk(0x00026000) = 0x00026000
22484 clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x7f588018,parent_tidptr=0x7f5884fc,tls=0x7f58f928,child_tidptr=0x7f5884fc) = 22503
22484 io_setup(4001536,2136506392,2136507644,2136507644,2136537384,4100) = -1 errno=38 (Function not implemented)
22484 futex(0x7f5884fc,FUTEX_WAIT,22503,NULL,NULL,0)22484 set_robust_list(2136507652,12,0,4100,2136508076,4100) = -1 errno=38 (Function not implemented)
22484 madvise(2128117760,8372224,4,2136507672,528660,4100) = 0
22484 exit(0)
 = 0
22484 fstat64(1,0x7fffef48) = 0
22484 write(1,0x51e8,42)FAIL: a= 10, thr_a = 10 Addr = 0x7f715120
 = 42
22484 exit_group(1)
sandra@build2-trusty-cs:/scratch/sandra/nios2-linux-trunk3$ 
22484 mmap2(NULL,1491048,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f589000
22484 mmap2(0x7f6de000,86016,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x154) = 0x7f6de000
22484 mmap2(0x7f6f3000,8296,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f6f3000
22484 close(3) = 0
22484 mprotect(0x7f6de000,65536,PROT_READ) = 0
22484 mprotect(0x7f70f000,8192,PROT_READ) = 0
22484 mprotect(0x7f7d8000,4096,PROT_READ) = 0
22484 mprotect(0x00003000,4096,PROT_READ) = 0
22484 mprotect(0x7f7fc000,4096,PROT_READ) = 0
22484 set_tid_address(2138131700,2147480980,2147480988,2147480988,87148,47) = 22484
22484 set_robust_list(2138131708,12,2147480988,0,87148,47) = -1 errno=38 (Function not implemented)
22484 rt_sigaction(32,0x7ffff36c,NULL) = 0
22484 rt_sigaction(33,0x7ffff36c,NULL) = -1 errno=22 (Invalid argument)
22484 rt_sigprocmask(SIG_UNBLOCK,0x7ffff4a8,NULL) = 0
22484 getrlimit(3,2147480732,3,0,62512,47) = 0
22484 mmap2(NULL,8392704,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|0x20000,-1,0) = 0x7ed88000
22484 mprotect(0x7ed89000,8388608,PROT_READ|PROT_WRITE) = 0
22484 brk(NULL) = 0x00005000
22484 brk(0x00026000) = 0x00026000
22484 clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x7f588018,parent_tidptr=0x7f5884fc,tls=0x7f58f928,child_tidptr=0x7f5884fc) = 22503
22484 io_setup(4001536,2136506392,2136507644,2136507644,2136537384,4100) = -1 errno=38 (Function not implemented)
22484 futex(0x7f5884fc,FUTEX_WAIT,22503,NULL,NULL,0)22484 set_robust_list(2136507652,12,0,4100,2136508076,4100) = -1 errno=38 (Function not implemented)
22484 madvise(2128117760,8372224,4,2136507672,528660,4100) = 0
22484 exit(0)
 = 0
22484 fstat64(1,0x7fffef48) = 0
22484 write(1,0x51e8,42)FAIL: a= 10, thr_a = 10 Addr = 0x7f715120
 = 42
22484 exit_group(1)
sandra@build2-trusty-cs:/scratch/sandra/nios2-linux-trunk3$ 
22484 mmap2(NULL,1491048,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f589000
22484 mmap2(0x7f6de000,86016,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x154) = 0x7f6de000
22484 mmap2(0x7f6f3000,8296,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f6f3000
22484 close(3) = 0
22484 mprotect(0x7f6de000,65536,PROT_READ) = 0
22484 mprotect(0x7f70f000,8192,PROT_READ) = 0
22484 mprotect(0x7f7d8000,4096,PROT_READ) = 0
22484 mprotect(0x00003000,4096,PROT_READ) = 0
22484 mprotect(0x7f7fc000,4096,PROT_READ) = 0
22484 set_tid_address(2138131700,2147480980,2147480988,2147480988,87148,47) = 22484
22484 set_robust_list(2138131708,12,2147480988,0,87148,47) = -1 errno=38 (Function not implemented)
22484 rt_sigaction(32,0x7ffff36c,NULL) = 0
22484 rt_sigaction(33,0x7ffff36c,NULL) = -1 errno=22 (Invalid argument)
22484 rt_sigprocmask(SIG_UNBLOCK,0x7ffff4a8,NULL) = 0
22484 getrlimit(3,2147480732,3,0,62512,47) = 0
22484 mmap2(NULL,8392704,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|0x20000,-1,0) = 0x7ed88000
22484 mprotect(0x7ed89000,8388608,PROT_READ|PROT_WRITE) = 0
22484 brk(NULL) = 0x00005000
22484 brk(0x00026000) = 0x00026000
22484 clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x7f588018,parent_tidptr=0x7f5884fc,tls=0x7f58f928,child_tidptr=0x7f5884fc) = 22503
22484 io_setup(4001536,2136506392,2136507644,2136507644,2136537384,4100) = -1 errno=38 (Function not implemented)
22484 futex(0x7f5884fc,FUTEX_WAIT,22503,NULL,NULL,0)22484 set_robust_list(2136507652,12,0,4100,2136508076,4100) = -1 errno=38 (Function not implemented)
22484 madvise(2128117760,8372224,4,2136507672,528660,4100) = 0
22484 exit(0)
 = 0
22484 fstat64(1,0x7fffef48) = 0
22484 write(1,0x51e8,42)FAIL: a= 10, thr_a = 10 Addr = 0x7f715120
 = 42
22484 exit_group(1)

Note that set_robust_list and clone are reported as unimplemented.

I've reported the problems with the signal syscalls separately here.
https://bugs.launchpad.net/qemu/+bug/1791763


Sandra Loosemore <email address hidden> writes:

> Public bug reported:
>
> This bug is reported against the 3.0 release.
>
> I noticed that the GCC test gcc.dg/torture/tls/tls-test.c is failing
> when run in user-mode qemu for nios2 target.  The problem appears to be
> that the thread-related syscalls are unimplemented in qemu.  Here is
> output from running with -strace:

One thing that would help in better supporting NIOS is if we could add
support for building linux-user tests for it in test/tcg. For this we
need a distribution that ships a decent cross compiler or create a
docker recipe that packages it up so we can build and run the tests.

Are you just building GCC straight from source or can you point to a
recommended location for a decent packaged gcc?

>
> 22484 brk(NULL) = 0x00005000
> 22484 uname(0x7fffef5a) = 0
> 22484 faccessat(AT_FDCWD,"/etc/ld.so.preload",R_OK,0x5) = -1 errno=2 (No such file or directory)
> 22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./tls/libm.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 errno=2 (No such file or directory)
> 22484 fstatat64(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./tls",0x7fffe870,0) = -1 errno=2 (No such file or directory)
> 22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libm.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
> 22484 read(3,0x7fffe954,512) = 512
> 22484 fstat64(3,0x7fffe870) = 0
> 22484 mmap2(NULL,803596,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f716000
> 22484 mmap2(0x7f7d8000,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0xc1) = 0x7f7d8000
> 22484 close(3) = 0
> 22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libpthread.so.0",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
> 22484 read(3,0x7fffe948,512) = 512
> 22484 mmap2(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x7f714000
> 22484 fstat64(3,0x7fffe864) = 0
> 22484 mmap2(NULL,120700,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f6f6000
> 22484 mprotect(0x7f70e000,4096,PROT_NONE) = 0
> 22484 mmap2(0x7f70f000,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x18) = 0x7f70f000
> 22484 mmap2(0x7f712000,6012,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f712000
> 22484 close(3) = 0
> 22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libc.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
> 22484 read(3,0x7fffe93c,512) = 512
> 22484 fstat64(3,0x7fffe858) = 0
> 22484 mmap2(NULL,1491048,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f589000
> 22484 mmap2(0x7f6de000,86016,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x154) = 0x7f6de000
> 22484 mmap2(0x7f6f3000,8296,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f6f3000
> 22484 close(3) = 0
> 22484 mprotect(0x7f6de000,65536,PROT_READ) = 0
> 22484 mprotect(0x7f70f000,8192,PROT_READ) = 0
> 22484 mprotect(0x7f7d8000,4096,PROT_READ) = 0
> 22484 mprotect(0x00003000,4096,PROT_READ) = 0
> 22484 mprotect(0x7f7fc000,4096,PROT_READ) = 0
> 22484 set_tid_address(2138131700,2147480980,2147480988,2147480988,87148,47) = 22484
> 22484 set_robust_list(2138131708,12,2147480988,0,87148,47) = -1 errno=38 (Function not implemented)
> 22484 rt_sigaction(32,0x7ffff36c,NULL) = 0
> 22484 rt_sigaction(33,0x7ffff36c,NULL) = -1 errno=22 (Invalid argument)
> 22484 rt_sigprocmask(SIG_UNBLOCK,0x7ffff4a8,NULL) = 0
> 22484 getrlimit(3,2147480732,3,0,62512,47) = 0
> 22484 mmap2(NULL,8392704,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|0x20000,-1,0) = 0x7ed88000
> 22484 mprotect(0x7ed89000,8388608,PROT_READ|PROT_WRITE) = 0
> 22484 brk(NULL) = 0x00005000
> 22484 brk(0x00026000) = 0x00026000
> 22484 clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x7f588018,parent_tidptr=0x7f5884fc,tls=0x7f58f928,child_tidptr=0x7f5884fc) = 22503
> 22484 io_setup(4001536,2136506392,2136507644,2136507644,2136537384,4100) = -1 errno=38 (Function not implemented)
> 22484 futex(0x7f5884fc,FUTEX_WAIT,22503,NULL,NULL,0)22484 set_robust_list(2136507652,12,0,4100,2136508076,4100) = -1 errno=38 (Function not implemented)
> 22484 madvise(2128117760,8372224,4,2136507672,528660,4100) = 0
> 22484 exit(0)
>  = 0
> 22484 fstat64(1,0x7fffef48) = 0
> 22484 write(1,0x51e8,42)FAIL: a= 10, thr_a = 10 Addr = 0x7f715120
>  = 42
> 22484 exit_group(1)
> sandra@build2-trusty-cs:/scratch/sandra/nios2-linux-trunk3$
> 22484 mmap2(NULL,1491048,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f589000
> 22484 mmap2(0x7f6de000,86016,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x154) = 0x7f6de000
> 22484 mmap2(0x7f6f3000,8296,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f6f3000
> 22484 close(3) = 0
> 22484 mprotect(0x7f6de000,65536,PROT_READ) = 0
> 22484 mprotect(0x7f70f000,8192,PROT_READ) = 0
> 22484 mprotect(0x7f7d8000,4096,PROT_READ) = 0
> 22484 mprotect(0x00003000,4096,PROT_READ) = 0
> 22484 mprotect(0x7f7fc000,4096,PROT_READ) = 0
> 22484 set_tid_address(2138131700,2147480980,2147480988,2147480988,87148,47) = 22484
> 22484 set_robust_list(2138131708,12,2147480988,0,87148,47) = -1 errno=38 (Function not implemented)
> 22484 rt_sigaction(32,0x7ffff36c,NULL) = 0
> 22484 rt_sigaction(33,0x7ffff36c,NULL) = -1 errno=22 (Invalid argument)
> 22484 rt_sigprocmask(SIG_UNBLOCK,0x7ffff4a8,NULL) = 0
> 22484 getrlimit(3,2147480732,3,0,62512,47) = 0
> 22484 mmap2(NULL,8392704,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|0x20000,-1,0) = 0x7ed88000
> 22484 mprotect(0x7ed89000,8388608,PROT_READ|PROT_WRITE) = 0
> 22484 brk(NULL) = 0x00005000
> 22484 brk(0x00026000) = 0x00026000
> 22484 clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x7f588018,parent_tidptr=0x7f5884fc,tls=0x7f58f928,child_tidptr=0x7f5884fc) = 22503
> 22484 io_setup(4001536,2136506392,2136507644,2136507644,2136537384,4100) = -1 errno=38 (Function not implemented)
> 22484 futex(0x7f5884fc,FUTEX_WAIT,22503,NULL,NULL,0)22484 set_robust_list(2136507652,12,0,4100,2136508076,4100) = -1 errno=38 (Function not implemented)
> 22484 madvise(2128117760,8372224,4,2136507672,528660,4100) = 0
> 22484 exit(0)
>  = 0
> 22484 fstat64(1,0x7fffef48) = 0
> 22484 write(1,0x51e8,42)FAIL: a= 10, thr_a = 10 Addr = 0x7f715120
>  = 42
> 22484 exit_group(1)
> sandra@build2-trusty-cs:/scratch/sandra/nios2-linux-trunk3$
> 22484 mmap2(NULL,1491048,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f589000
> 22484 mmap2(0x7f6de000,86016,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x154) = 0x7f6de000
> 22484 mmap2(0x7f6f3000,8296,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f6f3000
> 22484 close(3) = 0
> 22484 mprotect(0x7f6de000,65536,PROT_READ) = 0
> 22484 mprotect(0x7f70f000,8192,PROT_READ) = 0
> 22484 mprotect(0x7f7d8000,4096,PROT_READ) = 0
> 22484 mprotect(0x00003000,4096,PROT_READ) = 0
> 22484 mprotect(0x7f7fc000,4096,PROT_READ) = 0
> 22484 set_tid_address(2138131700,2147480980,2147480988,2147480988,87148,47) = 22484
> 22484 set_robust_list(2138131708,12,2147480988,0,87148,47) = -1 errno=38 (Function not implemented)
> 22484 rt_sigaction(32,0x7ffff36c,NULL) = 0
> 22484 rt_sigaction(33,0x7ffff36c,NULL) = -1 errno=22 (Invalid argument)
> 22484 rt_sigprocmask(SIG_UNBLOCK,0x7ffff4a8,NULL) = 0
> 22484 getrlimit(3,2147480732,3,0,62512,47) = 0
> 22484 mmap2(NULL,8392704,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|0x20000,-1,0) = 0x7ed88000
> 22484 mprotect(0x7ed89000,8388608,PROT_READ|PROT_WRITE) = 0
> 22484 brk(NULL) = 0x00005000
> 22484 brk(0x00026000) = 0x00026000
> 22484 clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x7f588018,parent_tidptr=0x7f5884fc,tls=0x7f58f928,child_tidptr=0x7f5884fc) = 22503
> 22484 io_setup(4001536,2136506392,2136507644,2136507644,2136537384,4100) = -1 errno=38 (Function not implemented)
> 22484 futex(0x7f5884fc,FUTEX_WAIT,22503,NULL,NULL,0)22484 set_robust_list(2136507652,12,0,4100,2136508076,4100) = -1 errno=38 (Function not implemented)
> 22484 madvise(2128117760,8372224,4,2136507672,528660,4100) = 0
> 22484 exit(0)
>  = 0
> 22484 fstat64(1,0x7fffef48) = 0
> 22484 write(1,0x51e8,42)FAIL: a= 10, thr_a = 10 Addr = 0x7f715120
>  = 42
> 22484 exit_group(1)
>
> Note that set_robust_list and clone are reported as unimplemented.
>
> I've reported the problems with the signal syscalls separately here.
> https://bugs.launchpad.net/qemu/+bug/1791763
>
> ** Affects: qemu
>      Importance: Undecided
>          Status: New


--
Alex Bennée



Thomas Huth <email address hidden> writes:

> On 2018-09-11 10:49, Alex Bennée wrote:
>>
>> Sandra Loosemore <email address hidden> writes:
>>
>>> Public bug reported:
>>>
>>> This bug is reported against the 3.0 release.
>>>
>>> I noticed that the GCC test gcc.dg/torture/tls/tls-test.c is failing
>>> when run in user-mode qemu for nios2 target.  The problem appears to be
>>> that the thread-related syscalls are unimplemented in qemu.  Here is
>>> output from running with -strace:
>>
>> One thing that would help in better supporting NIOS is if we could add
>> support for building linux-user tests for it in test/tcg. For this we
>> need a distribution that ships a decent cross compiler or create a
>> docker recipe that packages it up so we can build and run the tests.
>>
>> Are you just building GCC straight from source or can you point to a
>> recommended location for a decent packaged gcc?
>
> Not sure if it's of any help, but buildroot.org has support for nios2,
> including automatic setup of a cross-compiler...

Maybe its time to add a buildroot base docker image with rules for
building the various additional toolchains. I'll have a go.

>
>  Thomas
>
>
>>> 22484 brk(NULL) = 0x00005000
>>> 22484 uname(0x7fffef5a) = 0
>>> 22484 faccessat(AT_FDCWD,"/etc/ld.so.preload",R_OK,0x5) = -1 errno=2 (No such file or directory)
>>> 22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./tls/libm.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 errno=2 (No such file or directory)
>>> 22484 fstatat64(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./tls",0x7fffe870,0) = -1 errno=2 (No such file or directory)
>>> 22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libm.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
>>> 22484 read(3,0x7fffe954,512) = 512
>>> 22484 fstat64(3,0x7fffe870) = 0
>>> 22484 mmap2(NULL,803596,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f716000
>>> 22484 mmap2(0x7f7d8000,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0xc1) = 0x7f7d8000
>>> 22484 close(3) = 0
>>> 22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libpthread.so.0",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
>>> 22484 read(3,0x7fffe948,512) = 512
>>> 22484 mmap2(NULL,8192,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x7f714000
>>> 22484 fstat64(3,0x7fffe864) = 0
>>> 22484 mmap2(NULL,120700,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f6f6000
>>> 22484 mprotect(0x7f70e000,4096,PROT_NONE) = 0
>>> 22484 mmap2(0x7f70f000,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x18) = 0x7f70f000
>>> 22484 mmap2(0x7f712000,6012,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f712000
>>> 22484 close(3) = 0
>>> 22484 openat(AT_FDCWD,"/scratch/sandra/nios2-linux-trunk3/obj/test-2018.11-999999-nios2-linux-gnu/host-x86_64-linux-gnu/sourceryg++-2018.11/nios2-linux-gnu/libc/./lib/./libc.so.6",O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
>>> 22484 read(3,0x7fffe93c,512) = 512
>>> 22484 fstat64(3,0x7fffe858) = 0
>>> 22484 mmap2(NULL,1491048,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f589000
>>> 22484 mmap2(0x7f6de000,86016,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x154) = 0x7f6de000
>>> 22484 mmap2(0x7f6f3000,8296,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f6f3000
>>> 22484 close(3) = 0
>>> 22484 mprotect(0x7f6de000,65536,PROT_READ) = 0
>>> 22484 mprotect(0x7f70f000,8192,PROT_READ) = 0
>>> 22484 mprotect(0x7f7d8000,4096,PROT_READ) = 0
>>> 22484 mprotect(0x00003000,4096,PROT_READ) = 0
>>> 22484 mprotect(0x7f7fc000,4096,PROT_READ) = 0
>>> 22484 set_tid_address(2138131700,2147480980,2147480988,2147480988,87148,47) = 22484
>>> 22484 set_robust_list(2138131708,12,2147480988,0,87148,47) = -1 errno=38 (Function not implemented)
>>> 22484 rt_sigaction(32,0x7ffff36c,NULL) = 0
>>> 22484 rt_sigaction(33,0x7ffff36c,NULL) = -1 errno=22 (Invalid argument)
>>> 22484 rt_sigprocmask(SIG_UNBLOCK,0x7ffff4a8,NULL) = 0
>>> 22484 getrlimit(3,2147480732,3,0,62512,47) = 0
>>> 22484 mmap2(NULL,8392704,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|0x20000,-1,0) = 0x7ed88000
>>> 22484 mprotect(0x7ed89000,8388608,PROT_READ|PROT_WRITE) = 0
>>> 22484 brk(NULL) = 0x00005000
>>> 22484 brk(0x00026000) = 0x00026000
>>> 22484 clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x7f588018,parent_tidptr=0x7f5884fc,tls=0x7f58f928,child_tidptr=0x7f5884fc) = 22503
>>> 22484 io_setup(4001536,2136506392,2136507644,2136507644,2136537384,4100) = -1 errno=38 (Function not implemented)
>>> 22484 futex(0x7f5884fc,FUTEX_WAIT,22503,NULL,NULL,0)22484 set_robust_list(2136507652,12,0,4100,2136508076,4100) = -1 errno=38 (Function not implemented)
>>> 22484 madvise(2128117760,8372224,4,2136507672,528660,4100) = 0
>>> 22484 exit(0)
>>>  = 0
>>> 22484 fstat64(1,0x7fffef48) = 0
>>> 22484 write(1,0x51e8,42)FAIL: a= 10, thr_a = 10 Addr = 0x7f715120
>>>  = 42
>>> 22484 exit_group(1)
>>> sandra@build2-trusty-cs:/scratch/sandra/nios2-linux-trunk3$
>>> 22484 mmap2(NULL,1491048,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f589000
>>> 22484 mmap2(0x7f6de000,86016,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x154) = 0x7f6de000
>>> 22484 mmap2(0x7f6f3000,8296,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f6f3000
>>> 22484 close(3) = 0
>>> 22484 mprotect(0x7f6de000,65536,PROT_READ) = 0
>>> 22484 mprotect(0x7f70f000,8192,PROT_READ) = 0
>>> 22484 mprotect(0x7f7d8000,4096,PROT_READ) = 0
>>> 22484 mprotect(0x00003000,4096,PROT_READ) = 0
>>> 22484 mprotect(0x7f7fc000,4096,PROT_READ) = 0
>>> 22484 set_tid_address(2138131700,2147480980,2147480988,2147480988,87148,47) = 22484
>>> 22484 set_robust_list(2138131708,12,2147480988,0,87148,47) = -1 errno=38 (Function not implemented)
>>> 22484 rt_sigaction(32,0x7ffff36c,NULL) = 0
>>> 22484 rt_sigaction(33,0x7ffff36c,NULL) = -1 errno=22 (Invalid argument)
>>> 22484 rt_sigprocmask(SIG_UNBLOCK,0x7ffff4a8,NULL) = 0
>>> 22484 getrlimit(3,2147480732,3,0,62512,47) = 0
>>> 22484 mmap2(NULL,8392704,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|0x20000,-1,0) = 0x7ed88000
>>> 22484 mprotect(0x7ed89000,8388608,PROT_READ|PROT_WRITE) = 0
>>> 22484 brk(NULL) = 0x00005000
>>> 22484 brk(0x00026000) = 0x00026000
>>> 22484 clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x7f588018,parent_tidptr=0x7f5884fc,tls=0x7f58f928,child_tidptr=0x7f5884fc) = 22503
>>> 22484 io_setup(4001536,2136506392,2136507644,2136507644,2136537384,4100) = -1 errno=38 (Function not implemented)
>>> 22484 futex(0x7f5884fc,FUTEX_WAIT,22503,NULL,NULL,0)22484 set_robust_list(2136507652,12,0,4100,2136508076,4100) = -1 errno=38 (Function not implemented)
>>> 22484 madvise(2128117760,8372224,4,2136507672,528660,4100) = 0
>>> 22484 exit(0)
>>>  = 0
>>> 22484 fstat64(1,0x7fffef48) = 0
>>> 22484 write(1,0x51e8,42)FAIL: a= 10, thr_a = 10 Addr = 0x7f715120
>>>  = 42
>>> 22484 exit_group(1)
>>> sandra@build2-trusty-cs:/scratch/sandra/nios2-linux-trunk3$
>>> 22484 mmap2(NULL,1491048,PROT_EXEC|PROT_READ,MAP_PRIVATE|MAP_DENYWRITE,3,0) = 0x7f589000
>>> 22484 mmap2(0x7f6de000,86016,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_DENYWRITE|MAP_FIXED,3,0x154) = 0x7f6de000
>>> 22484 mmap2(0x7f6f3000,8296,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,-1,0) = 0x7f6f3000
>>> 22484 close(3) = 0
>>> 22484 mprotect(0x7f6de000,65536,PROT_READ) = 0
>>> 22484 mprotect(0x7f70f000,8192,PROT_READ) = 0
>>> 22484 mprotect(0x7f7d8000,4096,PROT_READ) = 0
>>> 22484 mprotect(0x00003000,4096,PROT_READ) = 0
>>> 22484 mprotect(0x7f7fc000,4096,PROT_READ) = 0
>>> 22484 set_tid_address(2138131700,2147480980,2147480988,2147480988,87148,47) = 22484
>>> 22484 set_robust_list(2138131708,12,2147480988,0,87148,47) = -1 errno=38 (Function not implemented)
>>> 22484 rt_sigaction(32,0x7ffff36c,NULL) = 0
>>> 22484 rt_sigaction(33,0x7ffff36c,NULL) = -1 errno=22 (Invalid argument)
>>> 22484 rt_sigprocmask(SIG_UNBLOCK,0x7ffff4a8,NULL) = 0
>>> 22484 getrlimit(3,2147480732,3,0,62512,47) = 0
>>> 22484 mmap2(NULL,8392704,PROT_NONE,MAP_PRIVATE|MAP_ANONYMOUS|0x20000,-1,0) = 0x7ed88000
>>> 22484 mprotect(0x7ed89000,8388608,PROT_READ|PROT_WRITE) = 0
>>> 22484 brk(NULL) = 0x00005000
>>> 22484 brk(0x00026000) = 0x00026000
>>> 22484 clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,child_stack=0x7f588018,parent_tidptr=0x7f5884fc,tls=0x7f58f928,child_tidptr=0x7f5884fc) = 22503
>>> 22484 io_setup(4001536,2136506392,2136507644,2136507644,2136537384,4100) = -1 errno=38 (Function not implemented)
>>> 22484 futex(0x7f5884fc,FUTEX_WAIT,22503,NULL,NULL,0)22484 set_robust_list(2136507652,12,0,4100,2136508076,4100) = -1 errno=38 (Function not implemented)
>>> 22484 madvise(2128117760,8372224,4,2136507672,528660,4100) = 0
>>> 22484 exit(0)
>>>  = 0
>>> 22484 fstat64(1,0x7fffef48) = 0
>>> 22484 write(1,0x51e8,42)FAIL: a= 10, thr_a = 10 Addr = 0x7f715120
>>>  = 42
>>> 22484 exit_group(1)
>>>
>>> Note that set_robust_list and clone are reported as unimplemented.
>>>
>>> I've reported the problems with the signal syscalls separately here.
>>> https://bugs.launchpad.net/qemu/+bug/1791763
>>>
>>> ** Affects: qemu
>>>      Importance: Undecided
>>>          Status: New
>>
>>
>> --
>> Alex Bennée
>>


--
Alex Bennée


Hi,

tl;dr Nios II linux-user seems pretty broken

Following up on some mailing list queries about the state of Nios II
Thomas pointed out that buildroot could build cross-compilers for the
architecture. As a quick experiment I've enabled a docker based
buildroot and turned on tests/tcg for it.

The results are not very encouraging as both linux-test and test-mmap
fail although (impressively?) testthread passes.

The test-mmap failure looks like some sort of argument mangling
failure as arg6 of target_mmap looks negative/big and hence causes the
mmap to fail. I tried messing with the #ifdef mangling logic in
do_syscall1 but failed to get it working.

The linux-test failure seems like a missing lseek system call but I
have no doubt there are others given the bug reports on list.

This series includes a hack to min uname which we can't really merge.
This is because buildroot is focused on building system images so sets
the glibc minimum kernel version to whatever it builds for the system
image. I leave the problem of programatically tuning the
qemu_nios2_10m50_defconfig to build a general purpose glibc to whoever
wants to take this forward.

As I'm not particularly interested in this architecture I don't intend
to spend any more time on this. Given how broken linux-user is I
suspect most users of QEMU's Nios 2 emulation use softmmu. If there is
interest in fixing up linux-user then the docker and test/tcg patches
can be included when the fixups are sent to the list. I would argue
that any linux-user target should at the very least pass all of
tests/tcg/multiarch - it's not super comprehensive but it's all we
have at the moment. Perhaps we should consider deprecating the
obviously less used linux-user targets?

Alex Bennée (4):
  docker: add debian-buildroot-base
  docker: add buildroot-nios2-cross image
  linux-user/nios2: bump min uname to 4.16.0 [!HACK]
  tests/tcg: add nios2 architecture (NEEDS FIXES)

 linux-user/nios2/target_syscall.h             |  2 +-
 tests/docker/Makefile.include                 |  6 ++++-
 .../dockerfiles/buildroot-nios2-cross.docker  | 10 +++++++
 .../dockerfiles/debian-buildroot-base.docker  | 26 +++++++++++++++++++
 tests/tcg/nios2/Makefile.include              |  2 ++
 5 files changed, 44 insertions(+), 2 deletions(-)
 create mode 100644 tests/docker/dockerfiles/buildroot-nios2-cross.docker
 create mode 100644 tests/docker/dockerfiles/debian-buildroot-base.docker
 create mode 100644 tests/tcg/nios2/Makefile.include

-- 
2.17.1



We can build some more cross-compilers using buildroot. This base
system contains simply the minimum number of tools required for
buildroot to work. We also download and unpack the buildroot source
tree as that will be common for all system deriving from it.

Signed-off-by: Alex Bennée <email address hidden>
---
 tests/docker/Makefile.include                 |  2 +-
 .../dockerfiles/debian-buildroot-base.docker  | 26 +++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 tests/docker/dockerfiles/debian-buildroot-base.docker

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index d3101afecd..74a82de48a 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -6,7 +6,7 @@ DOCKER_SUFFIX := .docker
 DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles
 DOCKER_DEPRECATED_IMAGES := debian
 # we don't run tests on intermediate images (used as base by another image)
-DOCKER_PARTIAL_IMAGES := debian debian8 debian9 debian8-mxe debian-ports debian-sid debian-bootstrap
+DOCKER_PARTIAL_IMAGES := debian debian8 debian9 debian8-mxe debian-ports debian-sid debian-bootstrap debian-buildroot-base
 DOCKER_IMAGES := $(filter-out $(DOCKER_DEPRECATED_IMAGES),$(sort $(notdir $(basename $(wildcard $(DOCKER_FILES_DIR)/*.docker)))))
 DOCKER_TARGETS := $(patsubst %,docker-image-%,$(DOCKER_IMAGES))
 # Use a global constant ccache directory to speed up repetitive builds
diff --git a/tests/docker/dockerfiles/debian-buildroot-base.docker b/tests/docker/dockerfiles/debian-buildroot-base.docker
new file mode 100644
index 0000000000..c4a29abadd
--- /dev/null
+++ b/tests/docker/dockerfiles/debian-buildroot-base.docker
@@ -0,0 +1,26 @@
+#
+# Buildroot base setup on Debian
+#
+
+FROM debian:stretch-slim
+ENV BUILDROOT_VERSION=2018.08
+
+# Duplicate deb line as deb-src
+RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
+
+# Install common build utilities
+RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt install -y bc \
+                   build-essential \
+                   cpio \
+                   file \
+                   python \
+                   unzip \
+                   rsync \
+                   wget
+
+# Grab the current buildroot version and unpack in /opt
+RUN mkdir -p /opt
+RUN cd /opt && wget https://buildroot.org/downloads/buildroot-${BUILDROOT_VERSION}.tar.gz
+RUN cd /opt && tar -xvf buildroot-${BUILDROOT_VERSION}.tar.gz
-- 
2.17.1



Build a buildroot toolchain for the nios2 target.

Signed-off-by: Alex Bennée <email address hidden>
---
 tests/docker/Makefile.include                         |  4 ++++
 tests/docker/dockerfiles/buildroot-nios2-cross.docker | 10 ++++++++++
 2 files changed, 14 insertions(+)
 create mode 100644 tests/docker/dockerfiles/buildroot-nios2-cross.docker

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 74a82de48a..a8dfde8ed5 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -120,6 +120,10 @@ docker-image-debian-riscv64-cross: docker-image-debian-sid
 docker-image-debian-powerpc-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
+# Buildroot base images
+# These involve building the toolchains and can take some time
+docker-image-buildroot-nios2-cross: docker-image-debian-buildroot-base
+
 # Specialist build images, sometimes very limited tools
 docker-image-tricore-cross: docker-image-debian9
 
diff --git a/tests/docker/dockerfiles/buildroot-nios2-cross.docker b/tests/docker/dockerfiles/buildroot-nios2-cross.docker
new file mode 100644
index 0000000000..e573f0fa55
--- /dev/null
+++ b/tests/docker/dockerfiles/buildroot-nios2-cross.docker
@@ -0,0 +1,10 @@
+#
+# NIOS II toolchain
+#
+FROM qemu:debian-buildroot-base
+
+RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make qemu_nios2_10m50_defconfig
+RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make toolchain
+
+# The toolchain is in /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-*
+RUN ln -s /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-* /usr/bin
-- 
2.17.1



This is to work around the limitations of the buildroot
qemu_nios2_10m50_defconfig which sets the base kernel version for
glibc.

Signed-off-by: Alex Bennée <email address hidden>
---
 linux-user/nios2/target_syscall.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/nios2/target_syscall.h b/linux-user/nios2/target_syscall.h
index ca6b7e69f6..905b80d112 100644
--- a/linux-user/nios2/target_syscall.h
+++ b/linux-user/nios2/target_syscall.h
@@ -2,7 +2,7 @@
 #define TARGET_SYSCALL_H
 
 #define UNAME_MACHINE "nios2"
-#define UNAME_MINIMUM_RELEASE "3.19.0"
+#define UNAME_MINIMUM_RELEASE "4.16.0"
 
 struct target_pt_regs {
     unsigned long  r8;    /* r8-r15 Caller-saved GP registers */
-- 
2.17.1



Now we have a docker image with a nios2 compiler we can add the bits
to build our TCG tests.

Current failures:
  testmmap - fails in check_file_fixed_eof_mmaps due to inversion of offset
  linux-test - unimplemented lseek (probably others as well)

Signed-off-by: Alex Bennée <email address hidden>
---
 tests/tcg/nios2/Makefile.include | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 tests/tcg/nios2/Makefile.include

diff --git a/tests/tcg/nios2/Makefile.include b/tests/tcg/nios2/Makefile.include
new file mode 100644
index 0000000000..2ab4160435
--- /dev/null
+++ b/tests/tcg/nios2/Makefile.include
@@ -0,0 +1,2 @@
+DOCKER_IMAGE=buildroot-nios2-cross
+DOCKER_CROSS_COMPILER=nios2-linux-gcc
-- 
2.17.1



Le 11/09/2018 à 16:06, Alex Bennée a écrit :
> This is to work around the limitations of the buildroot
> qemu_nios2_10m50_defconfig which sets the base kernel version for
> glibc.
> 
> Signed-off-by: Alex Bennée <email address hidden>
> ---
>  linux-user/nios2/target_syscall.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/nios2/target_syscall.h b/linux-user/nios2/target_syscall.h
> index ca6b7e69f6..905b80d112 100644
> --- a/linux-user/nios2/target_syscall.h
> +++ b/linux-user/nios2/target_syscall.h
> @@ -2,7 +2,7 @@
>  #define TARGET_SYSCALL_H
>  
>  #define UNAME_MACHINE "nios2"
> -#define UNAME_MINIMUM_RELEASE "3.19.0"
> +#define UNAME_MINIMUM_RELEASE "4.16.0"
>  
>  struct target_pt_regs {
>      unsigned long  r8;    /* r8-r15 Caller-saved GP registers */
> 

I have no objection. Perhaps you could ask NiosII Maintainers (cc).

Laurent



Laurent Vivier <email address hidden> writes:

> Le 11/09/2018 à 16:06, Alex Bennée a écrit:
>> This is to work around the limitations of the buildroot
>> qemu_nios2_10m50_defconfig which sets the base kernel version for
>> glibc.
>>
>> Signed-off-by: Alex Bennée <email address hidden>
>> ---
>>  linux-user/nios2/target_syscall.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/linux-user/nios2/target_syscall.h b/linux-user/nios2/target_syscall.h
>> index ca6b7e69f6..905b80d112 100644
>> --- a/linux-user/nios2/target_syscall.h
>> +++ b/linux-user/nios2/target_syscall.h
>> @@ -2,7 +2,7 @@
>>  #define TARGET_SYSCALL_H
>>
>>  #define UNAME_MACHINE "nios2"
>> -#define UNAME_MINIMUM_RELEASE "3.19.0"
>> +#define UNAME_MINIMUM_RELEASE "4.16.0"
>>
>>  struct target_pt_regs {
>>      unsigned long  r8;    /* r8-r15 Caller-saved GP registers */
>>
>
> I have no objection. Perhaps you could ask NiosII Maintainers (cc).

Doh.. I had cccmd = scripts/get_maintainer.pl --nogit-fallback but of
course as I didn't actually touch an nios2 files it didn't include them.

Thanks.

>
> Laurent


--
Alex Bennée


Le 11/09/2018 à 16:40, Alex Bennée a écrit :
> 
> Laurent Vivier <email address hidden> writes:
> 
>> Le 11/09/2018 à 16:06, Alex Bennée a écrit:
>>> This is to work around the limitations of the buildroot
>>> qemu_nios2_10m50_defconfig which sets the base kernel version for
>>> glibc.
>>>
>>> Signed-off-by: Alex Bennée <email address hidden>
>>> ---
>>>  linux-user/nios2/target_syscall.h | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/linux-user/nios2/target_syscall.h b/linux-user/nios2/target_syscall.h
>>> index ca6b7e69f6..905b80d112 100644
>>> --- a/linux-user/nios2/target_syscall.h
>>> +++ b/linux-user/nios2/target_syscall.h
>>> @@ -2,7 +2,7 @@
>>>  #define TARGET_SYSCALL_H
>>>
>>>  #define UNAME_MACHINE "nios2"
>>> -#define UNAME_MINIMUM_RELEASE "3.19.0"
>>> +#define UNAME_MINIMUM_RELEASE "4.16.0"
>>>
>>>  struct target_pt_regs {
>>>      unsigned long  r8;    /* r8-r15 Caller-saved GP registers */
>>>
>>
>> I have no objection. Perhaps you could ask NiosII Maintainers (cc).
> 
> Doh.. I had cccmd = scripts/get_maintainer.pl --nogit-fallback but of
> course as I didn't actually touch an nios2 files it didn't include them.

I also use "git blame" to know who to bother ;)

Thanks,
Laurent




Marek Vasut <email address hidden> writes:

> On 09/11/2018 04:14 PM, Laurent Vivier wrote:
>> Le 11/09/2018 à 16:06, Alex Bennée a écrit:
>>> This is to work around the limitations of the buildroot
>>> qemu_nios2_10m50_defconfig which sets the base kernel version for
>>> glibc.
>>>
>>> Signed-off-by: Alex Bennée <email address hidden>
>>> ---
>>>  linux-user/nios2/target_syscall.h | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/linux-user/nios2/target_syscall.h b/linux-user/nios2/target_syscall.h
>>> index ca6b7e69f6..905b80d112 100644
>>> --- a/linux-user/nios2/target_syscall.h
>>> +++ b/linux-user/nios2/target_syscall.h
>>> @@ -2,7 +2,7 @@
>>>  #define TARGET_SYSCALL_H
>>>
>>>  #define UNAME_MACHINE "nios2"
>>> -#define UNAME_MINIMUM_RELEASE "3.19.0"
>>> +#define UNAME_MINIMUM_RELEASE "4.16.0"
>>>
>>>  struct target_pt_regs {
>>>      unsigned long  r8;    /* r8-r15 Caller-saved GP registers */
>>>
>>
>> I have no objection. Perhaps you could ask NiosII Maintainers (cc).
>
> If that's needed, so be it. The Linux 3.19 was required because some
> obscure ABI change happened at that point.

I don't think so - it's an artefact of the way the buildroot toolchain
is built. But the real question which I address in the cover letter is
does nios2-linux-user get much use? I tried enabled tests/tcg for it and
it fails rather badly.

--
Alex Bennée


If you need a Nios II GNU/Linux toolchain, I think the most recent CodeBench Lite release will work:

https://sourcery.mentor.com/GNUToolchain/subscription42545

We're planning on adding user-mode QEMU to the upcoming 2018.11 release....  that's actually what I've been testing it for.  Results on the GCC testsuite actually don't look too bad, but I have a patch I haven't submitted yet that's required to make the GDB stub work, and there are a lot of GDB test failures I haven't triaged yet.



Sandra Loosemore <email address hidden> writes:

> If you need a Nios II GNU/Linux toolchain, I think the most recent
> CodeBench Lite release will work:
>
> https://sourcery.mentor.com/GNUToolchain/subscription42545

Hmm I tried automating that but it seems the installer has GTK
dependencies!?

  Setup:
  GTK+ Version Check
  Setup:
  An error has occurred. See the log file
  /root/.mentor/logs/20180911185933/.metadata/.log.
  root@0ef91b5e50f2:/opt# cat /root/.mentor/logs/20180911185933/.metadata/.log
  !SESSION 2018-09-11 18:59:36.197 -----------------------------------------------
  eclipse.buildId=unknown
  java.version=1.8.0_102
  java.vendor=Oracle Corporation
  BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
  Framework arguments:  -install.once -install.data=/root/.mentor
  Command-line arguments:  -os linux -ws gtk -arch x86 -install.once -install.data=/root/.mentor -data /root/.mentor/logs/20180911185933

  !ENTRY org.eclipse.osgi 4 0 2018-09-11 18:59:37.407
  !MESSAGE Application error
  !STACK 1
  java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
          /tmp/sourceryg++-2018.05-5-nios2-linux-gnu.bin_sfx.f9eaefb7/installer/configuration/org.eclipse.osgi/148/0/.cp/libswt-pi-gtk-4530.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
          no swt-pi-gtk in java.library.path
          Can't load library: /root/.swt/lib/linux/x86/libswt-pi-gtk-4530.so
          Can't load library: /root/.swt/lib/linux/x86/libswt-pi-gtk.so
          /root/.swt/lib/linux/x86/libswt-pi-gtk-4530.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory

Should I just try the tarball approach?

> We're planning on adding user-mode QEMU to the upcoming 2018.11
> release....  that's actually what I've been testing it for.  Results on
> the GCC testsuite actually don't look too bad,

OK - I'm a little surprised given the failures I saw in our own
test/tcg/multiarch but it's totally possible that:

  - the buildroot toolchain if foobar
  - the (ancient) tests need tweaking

but it would be nice if we get to a point that QEMU's internal
linux-user tests also pass.

> but I have a patch I
> haven't submitted yet that's required to make the GDB stub work, and
> there are a lot of GDB test failures I haven't triaged yet.

When you do post the gdb patch feel free to CC me as I've poked around
in that before.

--
Alex Bennée



Marek Vasut <email address hidden> writes:

> On 09/11/2018 05:08 PM, Alex Bennée wrote:
>>
>> Marek Vasut <email address hidden> writes:
>>
>>> On 09/11/2018 04:14 PM, Laurent Vivier wrote:
>>>> Le 11/09/2018 à 16:06, Alex Bennée a écrit:
<snip>
>>
>> I don't think so - it's an artefact of the way the buildroot toolchain
>> is built. But the real question which I address in the cover letter is
>> does nios2-linux-user get much use? I tried enabled tests/tcg for it and
>> it fails rather badly.
>
> I used it around 2.10 and it worked for me.

I've just build 2.10.2 (with a patch for memfd and this one) and get the
same failures on the tcg/tests tests. What testing where you running?

--
Alex Bennée


Hi Alex,

On 9/11/18 4:06 PM, Alex Bennée wrote:
> We can build some more cross-compilers using buildroot. This base
> system contains simply the minimum number of tools required for
> buildroot to work. We also download and unpack the buildroot source
> tree as that will be common for all system deriving from it.
> 
> Signed-off-by: Alex Bennée <email address hidden>
> ---
>  tests/docker/Makefile.include                 |  2 +-
>  .../dockerfiles/debian-buildroot-base.docker  | 26 +++++++++++++++++++
>  2 files changed, 27 insertions(+), 1 deletion(-)
>  create mode 100644 tests/docker/dockerfiles/debian-buildroot-base.docker
> 
> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
> index d3101afecd..74a82de48a 100644
> --- a/tests/docker/Makefile.include
> +++ b/tests/docker/Makefile.include
> @@ -6,7 +6,7 @@ DOCKER_SUFFIX := .docker
>  DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles
>  DOCKER_DEPRECATED_IMAGES := debian
>  # we don't run tests on intermediate images (used as base by another image)
> -DOCKER_PARTIAL_IMAGES := debian debian8 debian9 debian8-mxe debian-ports debian-sid debian-bootstrap
> +DOCKER_PARTIAL_IMAGES := debian debian8 debian9 debian8-mxe debian-ports debian-sid debian-bootstrap debian-buildroot-base
>  DOCKER_IMAGES := $(filter-out $(DOCKER_DEPRECATED_IMAGES),$(sort $(notdir $(basename $(wildcard $(DOCKER_FILES_DIR)/*.docker)))))
>  DOCKER_TARGETS := $(patsubst %,docker-image-%,$(DOCKER_IMAGES))
>  # Use a global constant ccache directory to speed up repetitive builds
> diff --git a/tests/docker/dockerfiles/debian-buildroot-base.docker b/tests/docker/dockerfiles/debian-buildroot-base.docker
> new file mode 100644
> index 0000000000..c4a29abadd
> --- /dev/null
> +++ b/tests/docker/dockerfiles/debian-buildroot-base.docker
> @@ -0,0 +1,26 @@
> +#
> +# Buildroot base setup on Debian
> +#
> +
> +FROM debian:stretch-slim
> +ENV BUILDROOT_VERSION=2018.08

To avoid cache invalidate, please move this bellow...

> +
> +# Duplicate deb line as deb-src
> +RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
> +
> +# Install common build utilities
> +RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata
> +RUN DEBIAN_FRONTEND=noninteractive eatmydata \
> +    apt install -y bc \
> +                   build-essential \
> +                   cpio \
> +                   file \
> +                   python \
> +                   unzip \
> +                   rsync \
> +                   wget
> +
> +# Grab the current buildroot version and unpack in /opt

... here (or similar around):

   ENV BUILDROOT_VERSION=2018.08

> +RUN mkdir -p /opt
> +RUN cd /opt && wget https://buildroot.org/downloads/buildroot-${BUILDROOT_VERSION}.tar.gz
> +RUN cd /opt && tar -xvf buildroot-${BUILDROOT_VERSION}.tar.gz
> 

Reviewed-by: Philippe Mathieu-Daudé <email address hidden>
Tested-by: Philippe Mathieu-Daudé <email address hidden>


Hi Alex,

On 9/11/18 4:06 PM, Alex Bennée wrote:
> Build a buildroot toolchain for the nios2 target.
> 
> Signed-off-by: Alex Bennée <email address hidden>
> ---
>  tests/docker/Makefile.include                         |  4 ++++
>  tests/docker/dockerfiles/buildroot-nios2-cross.docker | 10 ++++++++++
>  2 files changed, 14 insertions(+)
>  create mode 100644 tests/docker/dockerfiles/buildroot-nios2-cross.docker
> 
> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
> index 74a82de48a..a8dfde8ed5 100644
> --- a/tests/docker/Makefile.include
> +++ b/tests/docker/Makefile.include
> @@ -120,6 +120,10 @@ docker-image-debian-riscv64-cross: docker-image-debian-sid
>  docker-image-debian-powerpc-cross: docker-image-debian-sid
>  docker-image-travis: NOUSER=1
>  
> +# Buildroot base images
> +# These involve building the toolchains and can take some time
> +docker-image-buildroot-nios2-cross: docker-image-debian-buildroot-base
> +
>  # Specialist build images, sometimes very limited tools
>  docker-image-tricore-cross: docker-image-debian9
>  
> diff --git a/tests/docker/dockerfiles/buildroot-nios2-cross.docker b/tests/docker/dockerfiles/buildroot-nios2-cross.docker
> new file mode 100644
> index 0000000000..e573f0fa55
> --- /dev/null
> +++ b/tests/docker/dockerfiles/buildroot-nios2-cross.docker
> @@ -0,0 +1,10 @@
> +#
> +# NIOS II toolchain
> +#
> +FROM qemu:debian-buildroot-base
> +
> +RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make qemu_nios2_10m50_defconfig

Simply:

  RUN make -C /opt/buildroot-${BUILDROOT_VERSION} qemu_nios2_10m50_defconfig

> +RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make toolchain

   RUN make -C /opt/buildroot-${BUILDROOT_VERSION} toolchain

> +# The toolchain is in /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-*
> +RUN ln -s /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-* /usr/bin

Similarly:

   ENV PATH $PATH:/opt/buildroot-${BUILDROOT_VERSION}/output/host/bin

Once build this image takes a bit more than 3GB (this took me 30min to
build).

With changes:
Reviewed-by: Philippe Mathieu-Daudé <email address hidden>
Tested-by: Philippe Mathieu-Daudé <email address hidden>



Philippe Mathieu-Daudé <email address hidden> writes:

> Hi Alex,
>
> On 9/11/18 4:06 PM, Alex Bennée wrote:
>> Build a buildroot toolchain for the nios2 target.
>>
>> Signed-off-by: Alex Bennée <email address hidden>
>> ---
>>  tests/docker/Makefile.include                         |  4 ++++
>>  tests/docker/dockerfiles/buildroot-nios2-cross.docker | 10 ++++++++++
>>  2 files changed, 14 insertions(+)
>>  create mode 100644 tests/docker/dockerfiles/buildroot-nios2-cross.docker
>>
>> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
>> index 74a82de48a..a8dfde8ed5 100644
>> --- a/tests/docker/Makefile.include
>> +++ b/tests/docker/Makefile.include
>> @@ -120,6 +120,10 @@ docker-image-debian-riscv64-cross: docker-image-debian-sid
>>  docker-image-debian-powerpc-cross: docker-image-debian-sid
>>  docker-image-travis: NOUSER=1
>>
>> +# Buildroot base images
>> +# These involve building the toolchains and can take some time
>> +docker-image-buildroot-nios2-cross: docker-image-debian-buildroot-base
>> +
>>  # Specialist build images, sometimes very limited tools
>>  docker-image-tricore-cross: docker-image-debian9
>>
>> diff --git a/tests/docker/dockerfiles/buildroot-nios2-cross.docker b/tests/docker/dockerfiles/buildroot-nios2-cross.docker
>> new file mode 100644
>> index 0000000000..e573f0fa55
>> --- /dev/null
>> +++ b/tests/docker/dockerfiles/buildroot-nios2-cross.docker
>> @@ -0,0 +1,10 @@
>> +#
>> +# NIOS II toolchain
>> +#
>> +FROM qemu:debian-buildroot-base
>> +
>> +RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make qemu_nios2_10m50_defconfig
>
> Simply:
>
>   RUN make -C /opt/buildroot-${BUILDROOT_VERSION} qemu_nios2_10m50_defconfig
>
>> +RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make toolchain
>
>    RUN make -C /opt/buildroot-${BUILDROOT_VERSION} toolchain
>
>> +# The toolchain is in /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-*
>> +RUN ln -s /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-* /usr/bin
>
> Similarly:
>
>    ENV PATH $PATH:/opt/buildroot-${BUILDROOT_VERSION}/output/host/bin
>
> Once build this image takes a bit more than 3GB (this took me 30min to
> build).
>
> With changes:
> Reviewed-by: Philippe Mathieu-Daudé <email address hidden>
> Tested-by: Philippe Mathieu-Daudé <email address hidden>

Apparently multi-stage builds are meant to help:

  https://docs.docker.com/develop/develop-images/multistage-build/#name-your-build-stages

It's still a little sub-optimal compared to binary builds but it will do
if we care about supporting every guest architecture with tests. I only
picked nios2 as a random example.

--
Alex Bennée


The QEMU project is currently considering to move its bug tracking to another system. For this we need to know which bugs are still valid and which could be closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state back to "New" within the next 60 days, otherwise this report will be marked as "Expired". Or mark it as "Fix Released" if the problem has been solved with a newer version of QEMU already. Thank you and sorry for the inconvenience.

[Expired for QEMU because there has been no activity for 60 days.]