-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix_profiling.patch
1126 lines (1104 loc) · 38.6 KB
/
fix_profiling.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -u b/elf/rtld.c b/elf/rtld.c
--- b/elf/rtld.c
+++ b/elf/rtld.c
@@ -988,10 +988,10 @@
return;
}
- if (lav > LAV_CURRENT)
+ if (lav != LAV_CURRENT)
{
_dl_debug_printf ("\
-ERROR: audit interface '%s' requires version %d (maximum supported version %d); ignored.\n",
+ERROR: audit interface '%s' requires version %d (current supported version %d); ignored.\n",
name, lav, LAV_CURRENT);
unload_audit_module (dlmargs.map, original_tls_idx);
return;
@@ -1053,6 +1053,8 @@
/* Mark the DSO as being used for auditing. */
dlmargs.map->l_auditing = 1;
+ /* Mark the DSO to not clear the TLS bss in tls initialization. */
+ dlmargs.map->l_dont_set_tls_static = 1;
}
/* Notify the the audit modules that the object MAP has already been
unchanged:
--- a/sysdeps/aarch64/Makefile
+++ b/sysdeps/aarch64/Makefile
@@ -10,6 +10,26 @@ endif
ifeq ($(subdir),elf)
sysdep-dl-routines += dl-bti
+
+tests += tst-audit26 \
+ tst-audit27
+
+modules-names += \
+ tst-audit26mod \
+ tst-auditmod26 \
+ tst-audit27mod \
+ tst-auditmod27
+
+$(objpfx)tst-audit26: $(objpfx)tst-audit26mod.so \
+ $(objpfx)tst-auditmod26.so
+LDFLAGS-tst-audit26 += -Wl,-z,lazy
+tst-audit26-ENV = LD_AUDIT=$(objpfx)tst-auditmod26.so
+
+$(objpfx)tst-audit27: $(objpfx)tst-audit27mod.so \
+ $(objpfx)tst-auditmod27.so
+$(objpfx)tst-audit27mod.so: $(libsupport)
+LDFLAGS-tst-audit27 += -Wl,-z,lazy
+tst-audit27-ENV = LD_AUDIT=$(objpfx)tst-auditmod27.so
endif
ifeq ($(subdir),elf)
unchanged:
--- a/sysdeps/aarch64/bits/link.h
+++ b/sysdeps/aarch64/bits/link.h
@@ -20,23 +20,29 @@
# error "Never include <bits/link.h> directly; use <link.h> instead."
#endif
+typedef union
+{
+ float s;
+ double d;
+ long double q;
+} La_aarch64_vector;
+
/* Registers for entry into PLT on AArch64. */
typedef struct La_aarch64_regs
{
- uint64_t lr_xreg[8];
- uint64_t lr_dreg[8];
- uint64_t lr_sp;
- uint64_t lr_lr;
+ uint64_t lr_xreg[9];
+ La_aarch64_vector lr_vreg[8];
+ uint64_t lr_sp;
+ uint64_t lr_lr;
} La_aarch64_regs;
/* Return values for calls from PLT on AArch64. */
typedef struct La_aarch64_retval
{
- /* Up to two integer registers can be used for a return value. */
- uint64_t lrv_xreg[2];
- /* Up to four D registers can be used for a return value. */
- uint64_t lrv_dreg[4];
-
+ /* Up to eight integer registers can be used for a return value. */
+ uint64_t lrv_xreg[8];
+ /* Up to eight V registers can be used for a return value. */
+ La_aarch64_vector lrv_vreg[8];
} La_aarch64_retval;
__BEGIN_DECLS
unchanged:
--- /dev/null
+++ b/sysdeps/aarch64/bits/link_lavcurrent.h
@@ -0,0 +1,25 @@
+/* Data structure for communication from the run-time dynamic linker for
+ loaded ELF shared objects. LAV_CURRENT definition.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _LINK_H
+# error "Never include <bits/link_lavcurrent.h> directly; use <link.h> instead."
+#endif
+
+/* Version numbers for la_version handshake interface. */
+#define LAV_CURRENT 2
unchanged:
--- a/sysdeps/aarch64/dl-link.sym
+++ b/sysdeps/aarch64/dl-link.sym
@@ -7,9 +7,9 @@ DL_SIZEOF_RG sizeof(struct La_aarch64_regs)
DL_SIZEOF_RV sizeof(struct La_aarch64_retval)
DL_OFFSET_RG_X0 offsetof(struct La_aarch64_regs, lr_xreg)
-DL_OFFSET_RG_D0 offsetof(struct La_aarch64_regs, lr_dreg)
+DL_OFFSET_RG_V0 offsetof(struct La_aarch64_regs, lr_vreg)
DL_OFFSET_RG_SP offsetof(struct La_aarch64_regs, lr_sp)
DL_OFFSET_RG_LR offsetof(struct La_aarch64_regs, lr_lr)
DL_OFFSET_RV_X0 offsetof(struct La_aarch64_retval, lrv_xreg)
-DL_OFFSET_RV_D0 offsetof(struct La_aarch64_retval, lrv_dreg)
+DL_OFFSET_RV_V0 offsetof(struct La_aarch64_retval, lrv_vreg)
unchanged:
--- a/sysdeps/aarch64/dl-trampoline.S
+++ b/sysdeps/aarch64/dl-trampoline.S
@@ -45,7 +45,8 @@ _dl_runtime_resolve:
cfi_rel_offset (lr, 8)
- /* Save arguments. */
+ /* Note: Saving x9 is not required by the ABI but the assember requires
+ the immediate values of operand 3 to be a multiple of 16 */
stp x8, x9, [sp, #-(80+8*16)]!
cfi_adjust_cfa_offset (80+8*16)
cfi_rel_offset (x8, 0)
@@ -142,13 +143,14 @@ _dl_runtime_profile:
Stack frame layout:
[sp, #...] lr
[sp, #...] &PLTGOT[n]
- [sp, #96] La_aarch64_regs
- [sp, #48] La_aarch64_retval
- [sp, #40] frame size return from pltenter
- [sp, #32] dl_profile_call saved x1
- [sp, #24] dl_profile_call saved x0
- [sp, #16] t1
- [sp, #0] x29, lr <- x29
+ alignment padding 8 bytes
+ La_aarch64_regs
+ La_aarch64_retval
+ frame size return from pltenter
+ dl_profile_call saved x1
+ dl_profile_call saved x0
+ t1
+ x29, lr <- x29
*/
# define OFFSET_T1 16
@@ -183,19 +185,22 @@ _dl_runtime_profile:
stp x6, x7, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*3]
cfi_rel_offset (x6, OFFSET_RG + DL_OFFSET_RG_X0 + 16*3 + 0)
cfi_rel_offset (x7, OFFSET_RG + DL_OFFSET_RG_X0 + 16*3 + 8)
-
- stp d0, d1, [X29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*0]
- cfi_rel_offset (d0, OFFSET_RG + DL_OFFSET_RG_D0 + 16*0)
- cfi_rel_offset (d1, OFFSET_RG + DL_OFFSET_RG_D0 + 16*0 + 8)
- stp d2, d3, [X29, #OFFSET_RG+ DL_OFFSET_RG_D0 + 16*1]
- cfi_rel_offset (d2, OFFSET_RG + DL_OFFSET_RG_D0 + 16*1 + 0)
- cfi_rel_offset (d3, OFFSET_RG + DL_OFFSET_RG_D0 + 16*1 + 8)
- stp d4, d5, [X29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*2]
- cfi_rel_offset (d4, OFFSET_RG + DL_OFFSET_RG_D0 + 16*2 + 0)
- cfi_rel_offset (d5, OFFSET_RG + DL_OFFSET_RG_D0 + 16*2 + 8)
- stp d6, d7, [X29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*3]
- cfi_rel_offset (d6, OFFSET_RG + DL_OFFSET_RG_D0 + 16*3 + 0)
- cfi_rel_offset (d7, OFFSET_RG + DL_OFFSET_RG_D0 + 16*3 + 8)
+ str x8, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*4 + 0]
+ cfi_rel_offset (x8, OFFSET_RG + DL_OFFSET_RG_X0 + 16*4 + 0)
+ /* Note 8 bytes of padding is in the stack frame for alignment */
+
+ stp q0, q1, [X29, #OFFSET_RG + DL_OFFSET_RG_V0 + 32*0]
+ cfi_rel_offset (q0, OFFSET_RG + DL_OFFSET_RG_V0 + 32*0)
+ cfi_rel_offset (q1, OFFSET_RG + DL_OFFSET_RG_V0 + 32*0 + 16)
+ stp q2, q3, [X29, #OFFSET_RG+ DL_OFFSET_RG_V0 + 32*1]
+ cfi_rel_offset (q2, OFFSET_RG + DL_OFFSET_RG_V0 + 32*1 + 0)
+ cfi_rel_offset (q3, OFFSET_RG + DL_OFFSET_RG_V0 + 32*1 + 16)
+ stp q4, q5, [X29, #OFFSET_RG + DL_OFFSET_RG_V0 + 32*2]
+ cfi_rel_offset (q4, OFFSET_RG + DL_OFFSET_RG_V0 + 32*2 + 0)
+ cfi_rel_offset (q5, OFFSET_RG + DL_OFFSET_RG_V0 + 32*2 + 16)
+ stp q6, q7, [X29, #OFFSET_RG + DL_OFFSET_RG_V0 + 32*3]
+ cfi_rel_offset (q6, OFFSET_RG + DL_OFFSET_RG_V0 + 32*3 + 0)
+ cfi_rel_offset (q7, OFFSET_RG + DL_OFFSET_RG_V0 + 32*3 + 16)
add x0, x29, #SF_SIZE + 16
ldr x1, [x29, #OFFSET_LR]
@@ -234,10 +239,11 @@ _dl_runtime_profile:
ldp x2, x3, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*1]
ldp x4, x5, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*2]
ldp x6, x7, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*3]
- ldp d0, d1, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*0]
- ldp d2, d3, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*1]
- ldp d4, d5, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*2]
- ldp d6, d7, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*3]
+ ldr x8, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*4]
+ ldp q0, q1, [x29, #OFFSET_RG + DL_OFFSET_RG_V0 + 32*0]
+ ldp q2, q3, [x29, #OFFSET_RG + DL_OFFSET_RG_V0 + 32*1]
+ ldp q4, q5, [x29, #OFFSET_RG + DL_OFFSET_RG_V0 + 32*2]
+ ldp q6, q7, [x29, #OFFSET_RG + DL_OFFSET_RG_V0 + 32*3]
cfi_def_cfa_register (sp)
ldp x29, x30, [x29, #0]
@@ -280,14 +286,21 @@ _dl_runtime_profile:
ldp x2, x3, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*1]
ldp x4, x5, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*2]
ldp x6, x7, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*3]
- ldp d0, d1, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*0]
- ldp d2, d3, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*1]
- ldp d4, d5, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*2]
- ldp d6, d7, [x29, #OFFSET_RG + DL_OFFSET_RG_D0 + 16*3]
+ ldr x8, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*4]
+ ldp q0, q1, [x29, #OFFSET_RG + DL_OFFSET_RG_V0 + 32*0]
+ ldp q2, q3, [x29, #OFFSET_RG + DL_OFFSET_RG_V0 + 32*1]
+ ldp q4, q5, [x29, #OFFSET_RG + DL_OFFSET_RG_V0 + 32*2]
+ ldp q6, q7, [x29, #OFFSET_RG + DL_OFFSET_RG_V0 + 32*3]
blr ip0
- stp x0, x1, [x29, #OFFSET_RV + DL_OFFSET_RV_X0]
- stp d0, d1, [x29, #OFFSET_RV + DL_OFFSET_RV_D0 + 16*0]
- stp d2, d3, [x29, #OFFSET_RV + DL_OFFSET_RV_D0 + 16*1]
+ stp x0, x1, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*0]
+ stp x2, x3, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*1]
+ stp x4, x5, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*2]
+ stp x6, x7, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*3]
+ str x8, [x29, #OFFSET_RG + DL_OFFSET_RG_X0 + 16*4]
+ stp q0, q1, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*0]
+ stp q2, q3, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*1]
+ stp q4, q5, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*2]
+ stp q6, q7, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*3]
/* Setup call to pltexit */
ldp x0, x1, [x29, #OFFSET_SAVED_CALL_X0]
@@ -295,9 +308,16 @@ _dl_runtime_profile:
add x3, x29, #OFFSET_RV
bl _dl_audit_pltexit
- ldp x0, x1, [x29, #OFFSET_RV + DL_OFFSET_RV_X0]
- ldp d0, d1, [x29, #OFFSET_RV + DL_OFFSET_RV_D0 + 16*0]
- ldp d2, d3, [x29, #OFFSET_RV + DL_OFFSET_RV_D0 + 16*1]
+ ldp x0, x1, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*0]
+ ldp x2, x3, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*1]
+ ldp x4, x5, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*2]
+ ldp x6, x7, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*3]
+ ldr x8, [x29, #OFFSET_RV + DL_OFFSET_RV_X0 + 16*4]
+ ldp q0, q1, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*0]
+ ldp q2, q3, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*1]
+ ldp q4, q5, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*2]
+ ldp q6, q7, [x29, #OFFSET_RV + DL_OFFSET_RV_V0 + 32*3]
+
/* LR from within La_aarch64_reg */
ldr lr, [x29, #OFFSET_RG + DL_OFFSET_RG_LR]
cfi_restore(lr)
unchanged:
--- /dev/null
+++ b/sysdeps/aarch64/tst-audit26.c
@@ -0,0 +1,37 @@
+/* Check DT_AUDIT for aarch64 ABI specifics.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <array_length.h>
+#include <string.h>
+#include <support/check.h>
+#include "tst-audit26mod.h"
+
+int
+do_test (void)
+{
+ /* Returning a large struct uses 'x8' as indirect result location. */
+ struct large_struct r = tst_audit26_func (ARG1, ARG2, ARG3);
+
+ struct large_struct e = set_large_struct (ARG1, ARG2, ARG3);
+
+ TEST_COMPARE_BLOB (r.a, sizeof (r.a), e.a, sizeof (e.a));
+
+ return 0;
+}
+
+#include <support/test-driver.c>
unchanged:
--- /dev/null
+++ b/sysdeps/aarch64/tst-audit26mod.c
@@ -0,0 +1,33 @@
+/* Check DT_AUDIT for aarch64 ABI specifics.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+#include "tst-audit26mod.h"
+
+struct large_struct
+tst_audit26_func (char a, short b, long int c)
+{
+ if (a != ARG1)
+ abort ();
+ if (b != ARG2)
+ abort ();
+ if (c != ARG3)
+ abort ();
+
+ return set_large_struct (a, b, c);
+}
unchanged:
--- /dev/null
+++ b/sysdeps/aarch64/tst-audit26mod.h
@@ -0,0 +1,50 @@
+/* Check DT_AUDIT for aarch64 specific ABI.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _TST_AUDIT27MOD_H
+#define _TST_AUDIT27MOD_H 1
+
+#include <array_length.h>
+
+struct large_struct
+{
+ char a[16];
+ short b[8];
+ long int c[4];
+};
+
+static inline struct large_struct
+set_large_struct (char a, short b, long int c)
+{
+ struct large_struct r;
+ for (int i = 0; i < array_length (r.a); i++)
+ r.a[i] = a;
+ for (int i = 0; i < array_length (r.b); i++)
+ r.b[i] = b;
+ for (int i = 0; i < array_length (r.c); i++)
+ r.c[i] = c;
+ return r;
+}
+
+#define ARG1 0x12
+#define ARG2 0x1234
+#define ARG3 0x12345678
+
+struct large_struct tst_audit26_func (char a, short b, long int c);
+
+#endif
unchanged:
--- /dev/null
+++ b/sysdeps/aarch64/tst-audit27.c
@@ -0,0 +1,64 @@
+/* Check DT_AUDIT for aarch64 ABI specifics.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <array_length.h>
+#include <string.h>
+#include <support/check.h>
+#include "tst-audit27mod.h"
+
+int
+do_test (void)
+{
+ {
+ float r = tst_audit27_func_float (FUNC_FLOAT_ARG0, FUNC_FLOAT_ARG1,
+ FUNC_FLOAT_ARG2, FUNC_FLOAT_ARG3,
+ FUNC_FLOAT_ARG4, FUNC_FLOAT_ARG5,
+ FUNC_FLOAT_ARG6, FUNC_FLOAT_ARG7);
+ if (r != FUNC_FLOAT_RET)
+ FAIL_EXIT1 ("tst_audit27_func_float() returned %a, expected %a",
+ r, FUNC_FLOAT_RET);
+ }
+
+ {
+ double r = tst_audit27_func_double (FUNC_DOUBLE_ARG0, FUNC_DOUBLE_ARG1,
+ FUNC_DOUBLE_ARG2, FUNC_DOUBLE_ARG3,
+ FUNC_DOUBLE_ARG4, FUNC_DOUBLE_ARG5,
+ FUNC_DOUBLE_ARG6, FUNC_DOUBLE_ARG7);
+ if (r != FUNC_DOUBLE_RET)
+ FAIL_EXIT1 ("tst_audit27_func_double() returned %la, expected %la",
+ r, FUNC_DOUBLE_RET);
+ }
+
+ {
+ long double r = tst_audit27_func_ldouble (FUNC_LDOUBLE_ARG0,
+ FUNC_LDOUBLE_ARG1,
+ FUNC_LDOUBLE_ARG2,
+ FUNC_LDOUBLE_ARG3,
+ FUNC_LDOUBLE_ARG4,
+ FUNC_LDOUBLE_ARG5,
+ FUNC_LDOUBLE_ARG6,
+ FUNC_LDOUBLE_ARG7);
+ if (r != FUNC_LDOUBLE_RET)
+ FAIL_EXIT1 ("tst_audit27_func_ldouble() returned %La, expected %La",
+ r, FUNC_LDOUBLE_RET);
+ }
+
+ return 0;
+}
+
+#include <support/test-driver.c>
unchanged:
--- /dev/null
+++ b/sysdeps/aarch64/tst-audit27mod.c
@@ -0,0 +1,95 @@
+/* Check DT_AUDIT for aarch64 ABI specifics.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <array_length.h>
+#include <stdlib.h>
+#include <support/check.h>
+#include "tst-audit27mod.h"
+
+float
+tst_audit27_func_float (float a0, float a1, float a2, float a3, float a4,
+ float a5, float a6, float a7)
+{
+ if (a0 != FUNC_FLOAT_ARG0)
+ FAIL_EXIT1 ("a0: %a != %a", a0, FUNC_FLOAT_ARG0);
+ if (a1 != FUNC_FLOAT_ARG1)
+ FAIL_EXIT1 ("a1: %a != %a", a1, FUNC_FLOAT_ARG1);
+ if (a2 != FUNC_FLOAT_ARG2)
+ FAIL_EXIT1 ("a2: %a != %a", a2, FUNC_FLOAT_ARG2);
+ if (a3 != FUNC_FLOAT_ARG3)
+ FAIL_EXIT1 ("a3: %a != %a", a3, FUNC_FLOAT_ARG3);
+ if (a4 != FUNC_FLOAT_ARG4)
+ FAIL_EXIT1 ("a4: %a != %a", a4, FUNC_FLOAT_ARG4);
+ if (a5 != FUNC_FLOAT_ARG5)
+ FAIL_EXIT1 ("a5: %a != %a", a5, FUNC_FLOAT_ARG5);
+ if (a6 != FUNC_FLOAT_ARG6)
+ FAIL_EXIT1 ("a6: %a != %a", a6, FUNC_FLOAT_ARG6);
+ if (a7 != FUNC_FLOAT_ARG7)
+ FAIL_EXIT1 ("a7: %a != %a", a7, FUNC_FLOAT_ARG7);
+
+ return FUNC_FLOAT_RET;
+}
+
+double
+tst_audit27_func_double (double a0, double a1, double a2, double a3, double a4,
+ double a5, double a6, double a7)
+{
+ if (a0 != FUNC_DOUBLE_ARG0)
+ FAIL_EXIT1 ("a0: %la != %la", a0, FUNC_DOUBLE_ARG0);
+ if (a1 != FUNC_DOUBLE_ARG1)
+ FAIL_EXIT1 ("a1: %la != %la", a1, FUNC_DOUBLE_ARG1);
+ if (a2 != FUNC_DOUBLE_ARG2)
+ FAIL_EXIT1 ("a2: %la != %la", a2, FUNC_DOUBLE_ARG2);
+ if (a3 != FUNC_DOUBLE_ARG3)
+ FAIL_EXIT1 ("a3: %la != %la", a3, FUNC_DOUBLE_ARG3);
+ if (a4 != FUNC_DOUBLE_ARG4)
+ FAIL_EXIT1 ("a4: %la != %la", a4, FUNC_DOUBLE_ARG4);
+ if (a5 != FUNC_DOUBLE_ARG5)
+ FAIL_EXIT1 ("a5: %la != %la", a5, FUNC_DOUBLE_ARG5);
+ if (a6 != FUNC_DOUBLE_ARG6)
+ FAIL_EXIT1 ("a6: %la != %la", a6, FUNC_DOUBLE_ARG6);
+ if (a7 != FUNC_DOUBLE_ARG7)
+ FAIL_EXIT1 ("a7: %la != %la", a7, FUNC_DOUBLE_ARG7);
+
+ return FUNC_DOUBLE_RET;
+}
+
+long double
+tst_audit27_func_ldouble (long double a0, long double a1, long double a2,
+ long double a3, long double a4, long double a5,
+ long double a6, long double a7)
+{
+ if (a0 != FUNC_LDOUBLE_ARG0)
+ FAIL_EXIT1 ("a0: %La != %La", a0, FUNC_LDOUBLE_ARG0);
+ if (a1 != FUNC_LDOUBLE_ARG1)
+ FAIL_EXIT1 ("a1: %La != %La", a1, FUNC_LDOUBLE_ARG1);
+ if (a2 != FUNC_LDOUBLE_ARG2)
+ FAIL_EXIT1 ("a2: %La != %La", a2, FUNC_LDOUBLE_ARG2);
+ if (a3 != FUNC_LDOUBLE_ARG3)
+ FAIL_EXIT1 ("a3: %La != %La", a3, FUNC_LDOUBLE_ARG3);
+ if (a4 != FUNC_LDOUBLE_ARG4)
+ FAIL_EXIT1 ("a4: %La != %La", a4, FUNC_LDOUBLE_ARG4);
+ if (a5 != FUNC_LDOUBLE_ARG5)
+ FAIL_EXIT1 ("a5: %La != %La", a5, FUNC_LDOUBLE_ARG5);
+ if (a6 != FUNC_LDOUBLE_ARG6)
+ FAIL_EXIT1 ("a6: %La != %La", a6, FUNC_LDOUBLE_ARG6);
+ if (a7 != FUNC_LDOUBLE_ARG7)
+ FAIL_EXIT1 ("a7: %La != %La", a7, FUNC_LDOUBLE_ARG7);
+
+ return FUNC_LDOUBLE_RET;
+}
unchanged:
--- /dev/null
+++ b/sysdeps/aarch64/tst-audit27mod.h
@@ -0,0 +1,67 @@
+/* Check DT_AUDIT for aarch64 specific ABI.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _TST_AUDIT27MOD_H
+#define _TST_AUDIT27MOD_H 1
+
+#include <float.h>
+
+#define FUNC_FLOAT_ARG0 FLT_MIN
+#define FUNC_FLOAT_ARG1 FLT_MAX
+#define FUNC_FLOAT_ARG2 FLT_EPSILON
+#define FUNC_FLOAT_ARG3 FLT_TRUE_MIN
+#define FUNC_FLOAT_ARG4 0.0f
+#define FUNC_FLOAT_ARG5 1.0f
+#define FUNC_FLOAT_ARG6 2.0f
+#define FUNC_FLOAT_ARG7 3.0f
+#define FUNC_FLOAT_RET 4.0f
+
+float
+tst_audit27_func_float (float a0, float a1, float a2, float a3, float a4,
+ float a5, float a6, float a7);
+
+#define FUNC_DOUBLE_ARG0 DBL_MIN
+#define FUNC_DOUBLE_ARG1 DBL_MAX
+#define FUNC_DOUBLE_ARG2 DBL_EPSILON
+#define FUNC_DOUBLE_ARG3 DBL_TRUE_MIN
+#define FUNC_DOUBLE_ARG4 0.0
+#define FUNC_DOUBLE_ARG5 1.0
+#define FUNC_DOUBLE_ARG6 2.0
+#define FUNC_DOUBLE_ARG7 3.0
+#define FUNC_DOUBLE_RET 0x1.fffffe0000001p+127
+
+double
+tst_audit27_func_double (double a0, double a1, double a2, double a3, double a4,
+ double a5, double a6, double a7);
+
+#define FUNC_LDOUBLE_ARG0 DBL_MAX + 1.0L
+#define FUNC_LDOUBLE_ARG1 DBL_MAX + 2.0L
+#define FUNC_LDOUBLE_ARG2 DBL_MAX + 3.0L
+#define FUNC_LDOUBLE_ARG3 DBL_MAX + 4.0L
+#define FUNC_LDOUBLE_ARG4 DBL_MAX + 5.0L
+#define FUNC_LDOUBLE_ARG5 DBL_MAX + 6.0L
+#define FUNC_LDOUBLE_ARG6 DBL_MAX + 7.0L
+#define FUNC_LDOUBLE_ARG7 DBL_MAX + 8.0L
+#define FUNC_LDOUBLE_RET 0x1.fffffffffffff000000000000001p+1023L
+
+long double
+tst_audit27_func_ldouble (long double a0, long double a1, long double a2,
+ long double a3, long double a4, long double a5,
+ long double a6, long double a7);
+
+#endif
unchanged:
--- /dev/null
+++ b/sysdeps/aarch64/tst-auditmod26.c
@@ -0,0 +1,93 @@
+/* Check DT_AUDIT for aarch64 specific ABI.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <assert.h>
+#include <link.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "tst-audit26mod.h"
+
+#define TEST_NAME "tst-audit26"
+
+#define AUDIT26_COOKIE 0
+
+unsigned int
+la_version (unsigned int v)
+{
+ return v;
+}
+
+unsigned int
+la_objopen (struct link_map *map, Lmid_t lmid, uintptr_t *cookie)
+{
+ const char *p = strrchr (map->l_name, '/');
+ const char *l_name = p == NULL ? map->l_name : p + 1;
+ uintptr_t ck = -1;
+ if (strncmp (l_name, TEST_NAME, strlen (TEST_NAME)) == 0)
+ ck = AUDIT26_COOKIE;
+ *cookie = ck;
+ printf ("objopen: %ld, %s\n", lmid, l_name);
+ return ck == -1 ? 0 : LA_FLG_BINDFROM | LA_FLG_BINDTO;
+}
+
+ElfW(Addr)
+la_aarch64_gnu_pltenter (ElfW(Sym) *sym __attribute__ ((unused)),
+ unsigned int ndx __attribute__ ((unused)),
+ uintptr_t *refcook, uintptr_t *defcook,
+ La_aarch64_regs *regs, unsigned int *flags,
+ const char *symname, long int *framesizep)
+{
+ printf ("pltenter: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
+ symname, (long int) sym->st_value, ndx, *flags);
+
+ if (strcmp (symname, "tst_audit26_func") == 0)
+ {
+ assert (regs->lr_xreg[0] == ARG1);
+ assert (regs->lr_xreg[1] == ARG2);
+ assert (regs->lr_xreg[2] == ARG3);
+ }
+ else
+ abort ();
+
+ /* Clobber 'x8'. */
+ asm volatile ("mov x8, -1" : : : "x8");
+
+ return sym->st_value;
+}
+
+unsigned int
+la_aarch64_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
+ uintptr_t *defcook,
+ const struct La_aarch64_regs *inregs,
+ struct La_aarch64_retval *outregs, const char *symname)
+{
+ if (strcmp (symname, "tst_audit26_func") == 0)
+ {
+ assert (inregs->lr_xreg[0] == ARG1);
+ assert (inregs->lr_xreg[1] == ARG2);
+ assert (inregs->lr_xreg[2] == ARG3);
+ }
+ else
+ abort ();
+
+ /* Clobber 'x8'. */
+ asm volatile ("mov x8, -1" : : : "x8");
+
+ return 0;
+}
unchanged:
--- /dev/null
+++ b/sysdeps/aarch64/tst-auditmod27.c
@@ -0,0 +1,173 @@
+/* Check DT_AUDIT for aarch64 specific ABI.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <assert.h>
+#include <link.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "tst-audit27mod.h"
+
+#define TEST_NAME "tst-audit27"
+
+#define AUDIT27_COOKIE 0
+
+unsigned int
+la_version (unsigned int v)
+{
+ return v;
+}
+
+unsigned int
+la_objopen (struct link_map *map, Lmid_t lmid, uintptr_t *cookie)
+{
+ const char *p = strrchr (map->l_name, '/');
+ const char *l_name = p == NULL ? map->l_name : p + 1;
+ uintptr_t ck = -1;
+ if (strncmp (l_name, TEST_NAME, strlen (TEST_NAME)) == 0)
+ ck = AUDIT27_COOKIE;
+ *cookie = ck;
+ printf ("objopen: %ld, %s\n", lmid, l_name);
+ return ck == -1 ? 0 : LA_FLG_BINDFROM | LA_FLG_BINDTO;
+}
+
+ElfW(Addr)
+la_aarch64_gnu_pltenter (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
+ uintptr_t *defcook, La_aarch64_regs *regs,
+ unsigned int *flags, const char *symname,
+ long int *framesizep)
+{
+ printf ("pltenter: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
+ symname, (long int) sym->st_value, ndx, *flags);
+
+ if (strcmp (symname, "tst_audit27_func_float") == 0)
+ {
+ assert (regs->lr_vreg[0].s == FUNC_FLOAT_ARG0);
+ assert (regs->lr_vreg[1].s == FUNC_FLOAT_ARG1);
+ assert (regs->lr_vreg[2].s == FUNC_FLOAT_ARG2);
+ assert (regs->lr_vreg[3].s == FUNC_FLOAT_ARG3);
+ assert (regs->lr_vreg[4].s == FUNC_FLOAT_ARG4);
+ assert (regs->lr_vreg[5].s == FUNC_FLOAT_ARG5);
+ assert (regs->lr_vreg[6].s == FUNC_FLOAT_ARG6);
+ assert (regs->lr_vreg[7].s == FUNC_FLOAT_ARG7);
+ }
+ else if (strcmp (symname, "tst_audit27_func_double") == 0)
+ {
+ assert (regs->lr_vreg[0].d == FUNC_DOUBLE_ARG0);
+ assert (regs->lr_vreg[1].d == FUNC_DOUBLE_ARG1);
+ assert (regs->lr_vreg[2].d == FUNC_DOUBLE_ARG2);
+ assert (regs->lr_vreg[3].d == FUNC_DOUBLE_ARG3);
+ assert (regs->lr_vreg[4].d == FUNC_DOUBLE_ARG4);
+ assert (regs->lr_vreg[5].d == FUNC_DOUBLE_ARG5);
+ assert (regs->lr_vreg[6].d == FUNC_DOUBLE_ARG6);
+ assert (regs->lr_vreg[7].d == FUNC_DOUBLE_ARG7);
+ }
+ else if (strcmp (symname, "tst_audit27_func_ldouble") == 0)
+ {
+ assert (regs->lr_vreg[0].q == FUNC_LDOUBLE_ARG0);
+ assert (regs->lr_vreg[1].q == FUNC_LDOUBLE_ARG1);
+ assert (regs->lr_vreg[2].q == FUNC_LDOUBLE_ARG2);
+ assert (regs->lr_vreg[3].q == FUNC_LDOUBLE_ARG3);
+ assert (regs->lr_vreg[4].q == FUNC_LDOUBLE_ARG4);
+ assert (regs->lr_vreg[5].q == FUNC_LDOUBLE_ARG5);
+ assert (regs->lr_vreg[6].q == FUNC_LDOUBLE_ARG6);
+ assert (regs->lr_vreg[7].q == FUNC_LDOUBLE_ARG7);
+ }
+ else
+ abort ();
+
+ /* Clobber the q registers on exit. */
+ uint8_t v = 0xff;
+ asm volatile ("dup v0.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v1.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v2.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v3.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v4.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v5.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v6.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v7.8b, %w0" : : "r" (v) : "v0");
+
+ return sym->st_value;
+}
+
+unsigned int
+la_aarch64_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
+ uintptr_t *defcook,
+ const struct La_aarch64_regs *inregs,
+ struct La_aarch64_retval *outregs,
+ const char *symname)
+{
+ printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u\n",
+ symname, (long int) sym->st_value, ndx);
+
+ if (strcmp (symname, "tst_audit27_func_float") == 0)
+ {
+ assert (inregs->lr_vreg[0].s == FUNC_FLOAT_ARG0);
+ assert (inregs->lr_vreg[1].s == FUNC_FLOAT_ARG1);
+ assert (inregs->lr_vreg[2].s == FUNC_FLOAT_ARG2);
+ assert (inregs->lr_vreg[3].s == FUNC_FLOAT_ARG3);
+ assert (inregs->lr_vreg[4].s == FUNC_FLOAT_ARG4);
+ assert (inregs->lr_vreg[5].s == FUNC_FLOAT_ARG5);
+ assert (inregs->lr_vreg[6].s == FUNC_FLOAT_ARG6);
+ assert (inregs->lr_vreg[7].s == FUNC_FLOAT_ARG7);
+
+ assert (outregs->lrv_vreg[0].s == FUNC_FLOAT_RET);
+ }
+ else if (strcmp (symname, "tst_audit27_func_double") == 0)
+ {
+ assert (inregs->lr_vreg[0].d == FUNC_DOUBLE_ARG0);
+ assert (inregs->lr_vreg[1].d == FUNC_DOUBLE_ARG1);
+ assert (inregs->lr_vreg[2].d == FUNC_DOUBLE_ARG2);
+ assert (inregs->lr_vreg[3].d == FUNC_DOUBLE_ARG3);
+ assert (inregs->lr_vreg[4].d == FUNC_DOUBLE_ARG4);
+ assert (inregs->lr_vreg[5].d == FUNC_DOUBLE_ARG5);
+ assert (inregs->lr_vreg[6].d == FUNC_DOUBLE_ARG6);
+ assert (inregs->lr_vreg[7].d == FUNC_DOUBLE_ARG7);
+
+ assert (outregs->lrv_vreg[0].s == FUNC_DOUBLE_RET);
+ }
+ else if (strcmp (symname, "tst_audit27_func_ldouble") == 0)
+ {
+ assert (inregs->lr_vreg[0].q == FUNC_LDOUBLE_ARG0);
+ assert (inregs->lr_vreg[1].q == FUNC_LDOUBLE_ARG1);
+ assert (inregs->lr_vreg[2].q == FUNC_LDOUBLE_ARG2);
+ assert (inregs->lr_vreg[3].q == FUNC_LDOUBLE_ARG3);
+ assert (inregs->lr_vreg[4].q == FUNC_LDOUBLE_ARG4);
+ assert (inregs->lr_vreg[5].q == FUNC_LDOUBLE_ARG5);
+ assert (inregs->lr_vreg[6].q == FUNC_LDOUBLE_ARG6);
+ assert (inregs->lr_vreg[7].q == FUNC_LDOUBLE_ARG7);
+
+ assert (outregs->lrv_vreg[0].s == FUNC_LDOUBLE_RET);
+ }
+ else
+ abort ();
+
+ /* Clobber the q registers on exit. */
+ uint8_t v = 0xff;
+ asm volatile ("dup v0.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v1.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v2.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v3.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v4.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v5.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v6.8b, %w0" : : "r" (v) : "v0");
+ asm volatile ("dup v7.8b, %w0" : : "r" (v) : "v0");
+
+ return 0;
+}
only in patch2:
unchanged:
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -223,6 +223,7 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
tst-audit18a tst-audit18b \
tst-audit19 \
tst-audit20 \
+ tst-audit21 \
tst-single_threaded tst-single_threaded-pthread \
tst-tls-ie tst-tls-ie-dlmopen argv0test \
tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \
@@ -307,6 +308,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
tst-auditmod18a tst-auditmod18b tst-audit18bmod \
tst-auditmod19 \
tst-auditmod20 tst-audit20mod \
+ tst-auditmod21 \
$(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \
tst-nodelete-uniquemod tst-nodelete-rtldmod \
tst-nodelete-zmod \
@@ -1520,6 +1522,9 @@ $(objpfx)tst-audit20.out: $(objpfx)tst-auditmod20.so \
$(objpfx)tst-audit20mod.so
tst-audit20-ARGS = -- $(host-test-program-cmd)
+$(objpfx)tst-audit21.out: $(objpfx)tst-auditmod21.so
+tst-audit21-ENV = LD_AUDIT=$(objpfx)tst-auditmod21.so
+
# tst-sonamemove links against an older implementation of the library.
LDFLAGS-tst-sonamemove-linkmod1.so = \
-Wl,--version-script=tst-sonamemove-linkmod1.map \
only in patch2:
unchanged:
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -175,6 +175,9 @@ _dl_new_object (char *realname, const char *libname, int type,
new->l_local_scope[0] = &new->l_searchlist;
+ if (mode & __RTLD_AUDIT)
+ new->l_dont_set_tls_static = 1;
+
/* Determine the origin. If allocating the link map for the main
executable, the realname is not known and "". In this case, the
origin needs to be determined by other means. However, in case
only in patch2:
unchanged:
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -593,10 +593,18 @@ _dl_allocate_tls_init (void *result)
some platforms use in static programs requires it. */
dtv[map->l_tls_modid].pointer.val = dest;
- /* Copy the initialization image and clear the BSS part. */
- memset (__mempcpy (dest, map->l_tls_initimage,
- map->l_tls_initimage_size), '\0',
- map->l_tls_blocksize - map->l_tls_initimage_size);
+ /* Copy the initialization image and clear the BSS part. For
+ ldaudit modules or depedencies with initial-exec TLS, we can not
+ set the initial TLS image on default loader initialization
+ because it would already be set by the ldaudit setup. However,
+ subsequent thread creation would need to follow the default
+ behaviour. */
+ if (__glibc_unlikely (!map->l_dont_set_tls_static))
+ memset (__mempcpy (dest, map->l_tls_initimage,
+ map->l_tls_initimage_size), '\0',
+ map->l_tls_blocksize - map->l_tls_initimage_size);
+ else
+ map->l_dont_set_tls_static = 0;
}
total += cnt;
only in patch2:
unchanged:
--- /dev/null
+++ b/elf/tst-audit21.c
@@ -0,0 +1,42 @@
+/* Check DT_AUDIT with static TLS.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.