-
Notifications
You must be signed in to change notification settings - Fork 2
/
chap4-elf32abi.sgml
5761 lines (4978 loc) · 204 KB
/
chap4-elf32abi.sgml
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
<!-- Author(s): See <authorgroup> in book-elfabi.sgml -->
<!-- Copyright (c) 2011, Power.org -->
<!-- Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3; with
no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is available in the COPYING.txt file. -->
<chapter id="OBJ-FILES"><title>Object Files</title>
<sect1 CONDITION="ATR-VLE" id="ELF-Object-Files-VLE">
<title>EABI Executable and Linking Format (ELF) Object Files</title>
<para>Implementations supporting VLE mark a per-page TLB entry storage control bit to indicate that a
memory page holds either VLE Category <emphasis role="bold">or</emphasis> Embedded Category
instructions. In this way the instructions in both the VLE category (<citetitle>Book VLE</citetitle>)
and the Embedded Category (<citetitle>Book III-E</citetitle>) of the Power ISA can coexist in the same
ELF binary.</para>
<para>Binding of VLE Category and Embedded Category memory pages to different memory bounds
requires separation of VLE Category and Embedded Category encodings into different ELF sections,
allowing easy identification for defining memory management page tables for run-time environments.
Memory pages of VLE Category and Embedded Category instructions can be freely intermixed. </para>
<para>The VLE encodings also require additional relocation types (see relocations 216 - 233 in
<emphasis><xref linkend="RELOCATION-TABLE"></emphasis>), which allow the link editor to resolve
immediate and branch displacement fields in the instruction encoding once a symbol or label address is
known (at link time).</para>
</sect1>
<sect1 CONDITION="ATR-EABI" id="OBJECT-FILE-PROCESSING-EABI">
<title>EABI Object File Processing</title>
<para>An EABI-conforming link editor shall accept as input EABI-conforming and SVR4-conforming relocatable files, and it
shall produce EABI-conforming shared object files.</para>
</sect1>
<sect1 id="ELF-HEAD">
<title>ELF Header</title>
<para>The <emphasis>file class</emphasis> member of the ELF header
identification array, <varname>e_ident[EI_CLASS]</varname>,
identifies the ELF file as 32-bit encoded by holding the value 1, defined as class
<varname>ELFCLASS32</varname>.</para>
<para>For a big-endian encoded ELF file the <emphasis>data
encoding</emphasis> member of the ELF header identification array,
<varname>e_ident[EI_DATA]</varname>, holds the value
<varname>2</varname>, defined as data encoding <varname>ELFDATA2MSB</varname>. For a little-endian encoded ELF
file it holds the value 1, defined as
data encoding <varname>ELFDATA2LSB</varname>.</para>
<para>The ELF header <varname>e_flags</varname> member may
hold the following bit masks that are applicable on the Power Architecture.</para>
<table frame="none"><title>e_flags Bit Masks</title>
<tgroup cols='3' colsep='0' rowsep='0'>
<colspec colwidth='140' colname='c1' align="left">
<colspec colwidth='60' colname='c2' align="left">
<colspec colwidth='200' colname='c3' align="left">
<thead>
<row rowsep='1'>
<entry>Mask</entry>
<entry>Value</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>EF_PPC_EMB</entry>
<entry>0x80000000</entry>
<entry>Power Architecture Embedded Flag.</entry>
</row>
<row>
<entry>EF_PPC_RELOCATABLE_LIB</entry>
<entry>0x00008000</entry>
<entry> Mark ELF file as relocatable (containing Position Independent
Code, see <emphasis><xref linkend="ADDRESSING-MODELS"></emphasis>) and
intended for use in a library. </entry>
</row>
<row>
<entry>EF_PPC_RELOCATABLE</entry>
<entry>0x00010000</entry>
<entry>Mark ELF file as relocatable (containing Position Independent
Code, see <emphasis><xref linkend="ADDRESSING-MODELS"></emphasis>).</entry>
</row>
</tbody>
</tgroup>
</table>
<!--
<para>An executable file (or shared library) is marked <varname>EF_PPC_RELOCATABLE_LIB</varname> if all
of the modules in the executable file have this flag.</para>
<para>Restrictive Text: A module with the <varname>EF_PPC_RELOCATABLE</varname> flag may only be linked
with modules which have the <varname>EF_PPC_RELOCATABLE</varname> or
<varname>EF_PPC_RELOCATABLE_LIB</varname> flags.</para>
<para>Permissive Text: An executable (or shared library) is marked <varname>EF_PPC_RELOCATABLE</varname>
if all of the modules in the executable have either the <varname>EF_PPC_RELOCATABLE</varname> or
<varname>EF_PPC_RELOCATABLE_LIB</varname> flags, but at least one module does not have the
<varname>EF_PPC_RELOCATABLE_LIB</varname> flag.</para>
<para>Modules which are marked <varname>EF_PPC_RELOCATABLE_LIB</varname> may be linked with either
relocatable or nonrelocatable modules.</para>
-->
<para CONDITION="ATR-EABI">EABI-conforming ELF files shall have <varname>EF_PPC_EMB</varname> set in
the <varname>e_flags</varname> member.</para>
<para>The ELF header <varname>e_machine</varname> member identifies the architecture of the ELF file
as the Power Architecture by holding the value 20, defined as machine name
<varname>EM_PPC</varname>.</para>
</sect1>
<sect1 id="SPECIAL-SECTIONS"><title>Special Sections</title>
<para>For the Power Architecture the following special sections with
their corresponding section types and attributes apply:</para>
<!-- <screen>
Name Type Attributes
.got SHT_PROGBITS SHF_ALLOC + SHF_WRITE
.sdata SHT_PROGBITS SHF_ALLOC + SHF_WRITE
.sbss SHT_NOBITS SHF_ALLOC + SHF_WRITE</screen><screen CONDITION="!ATR-LINUX">
.PPC.EMB.apuinfo SHT_NOTE 0 </screen><screen CONDITION="ATR-EABI">
.PPC.EMB.sdata2 SHT_PROGBITS SHF_ALLOC and possibly SHF_WRITE
(See Table 4-4)
.PPC.EMB.sdata0 SHT_PROGBITS SHF_ALLOC + SHF_WRITE
.PPC.EMB.sbss2 SHT_NOBITS SHF_ALLOC + SHF_WRITE
.PPC.EMB.sbss0 SHT_NOBITS SHF_ALLOC + SHF_WRITE
.PPC.EMB.seginfo SHT_PROGBITS 0</screen>
<screen CONDITION="ATR-SECURE-PLT">
.plt SHT_PROGBITS SHF_ALLOC + SHF_WRITE
</screen>
<screen CONDITION="ATR-BSS-PLT">
.plt SHT_NOBITS SHF_ALLOC + SHF_WRITE + SHF_EXECINSTR
</screen>-->
<variablelist id="ELF-SPECIAL-SECTIONS">
<varlistentry>
<term><emphasis role="bold">.got</emphasis></term>
<listitem>
<para> This section holds the <emphasis><link linkend="GLOBAL-OFFSET-TABLE">Global Offset Table</link></emphasis> (GOT). Further information on accessing data in the GOT is contained in <emphasis><xref linkend="DATA-OBJ"></emphasis>. Information on the layout of
the Global Offset Table is in <emphasis><xref linkend="GLOBAL-OFFSET-TABLE"></emphasis>.</para>
<informaltable frame="none">
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec colwidth='60' colname='c1' align="left">
<colspec colwidth='250' colname='c2' align="left">
<thead>
<row rowsep='1'>
<entry>Name</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>sh_name</entry>
<entry>.got</entry>
</row>
<row>
<entry>sh_type</entry>
<entry>SHT_PROGBITS</entry>
</row>
<row>
<entry>sh_flags</entry>
<entry>SHF_ALLOC + SHF_WRITE</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">.plt</emphasis></term>
<listitem>
<para> This section holds the <emphasis><link linkend="PLT">Procedure Linkage Table</link></emphasis> (PLT) (see
<emphasis><xref linkend="PLT"></emphasis>).</para>
<informaltable frame="none" CONDITION="ATR-SECURE-PLT">
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec colwidth='60' colname='c1' align="left">
<colspec colwidth='250' colname='c2' align="left">
<thead>
<row rowsep='1'>
<entry>Name</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>sh_name</entry>
<entry>.plt</entry>
</row>
<row>
<entry>sh_type</entry>
<entry>SHT_PROGBITS</entry>
</row>
<row>
<entry>sh_flags</entry>
<entry>SHF_ALLOC + SHF_WRITE</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<informaltable frame="none" CONDITION="ATR-BSS-PLT">
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec colwidth='60' colname='c1' align="left">
<colspec colwidth='250' colname='c2' align="left">
<thead>
<row rowsep='1'>
<entry>Name</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>sh_name</entry>
<entry>.plt</entry>
</row>
<row>
<entry>sh_type</entry>
<entry>SHT_NOBITS</entry>
</row>
<row>
<entry>sh_flags</entry>
<entry>SHF_ALLOC + SHF_WRITE + SHF_EXECINSTR</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">.sdata</emphasis></term>
<listitem>
<para></para><!-- necessary 'cause stylesheets don't conditionalize the first para. -->
<para CONDITION="ATR-LINUX"> Initialized data can be held in this section, which is part of
the <emphasis><link linkend="SMALL-DATA-AREA">Small Data Area</link></emphasis> (SDA). Further information is found in <emphasis><xref linkend="SMALL-DATA-AREA"></emphasis>.</para>
<para CONDITION="ATR-EABI"> Initialized data can be held in this section, which is part of
the <emphasis><link linkend="SDATA-AND-SBSS-E500">Small Data Area</link></emphasis> (SDA). Further information is found in <emphasis><xref linkend="SDATA-AND-SBSS-E500"></emphasis>.</para>
<informaltable frame="none">
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec colwidth='60' colname='c1' align="left">
<colspec colwidth='250' colname='c2' align="left">
<thead>
<row rowsep='1'>
<entry>Name</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>sh_name</entry>
<entry>.sdata</entry>
</row>
<row>
<entry>sh_type</entry>
<entry>SHT_PROGBITS</entry>
</row>
<row>
<entry>sh_flags</entry>
<entry>SHF_ALLOC + SHF_WRITE</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">.sbss</emphasis></term>
<listitem>
<para></para> <!-- necessary 'cause stylesheets don't conditionalize the first para. -->
<para CONDITION="ATR-LINUX"> Uninitialized data (set to zero on program
execution) can be held in this section, which is part of the SDA (Small Data
Area). Further information is found in <emphasis><xref linkend="SMALL-DATA-AREA"></emphasis>.</para>
<para CONDITION="ATR-EABI"> Uninitialized data (set to zero on program
execution) can be held in this section, which is part of the SDA (Small Data
Area). Further information is found in <emphasis><xref linkend="SDATA-AND-SBSS-E500"></emphasis>.</para>
<informaltable frame="none">
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec colwidth='60' colname='c1' align="left">
<colspec colwidth='250' colname='c2' align="left">
<thead>
<row rowsep='1'>
<entry>Name</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>sh_name</entry>
<entry>.sbss</entry>
</row>
<row>
<entry>sh_type</entry>
<entry>SHT_NOBITS</entry>
</row>
<row>
<entry>sh_flags</entry>
<entry>SHF_ALLOC + SHF_WRITE</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">.PPC.EMB.apuinfo</emphasis></term>
<listitem>
<para> If an APU is required this section will contain records describing which are required for a
program to execute properly. See <emphasis><xref linkend="APU-INFORMATION-SECTION"></emphasis> for further details. </para>
<informaltable frame="none">
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec colwidth='60' colname='c1' align="left">
<colspec colwidth='250' colname='c2' align="left">
<thead>
<row rowsep='1'>
<entry>Name</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>sh_name</entry>
<entry>.PPC.EMB.apuinfo</entry>
</row>
<row>
<entry>sh_type</entry>
<entry>SHT_NOTES</entry>
</row>
<row>
<entry>sh_flags</entry>
<entry>0</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
</variablelist>
</sect1>
<sect1 CONDITION="ATR-EABI" id="SPECIAL-SECTIONS-EABI">
<title>Special Embedded Sections</title>
<para>In addition to the special sections described in <emphasis><xref linkend="SPECIAL-SECTIONS"></emphasis>, an
EABI-conforming ELF file shall be allowed to contain the following special
sections. The SVR4 ABI has reserved for this document any
section names beginning with .PPC.EMB.</para>
<variablelist id="ELF-SPECIAL-EMBEDDED-SECTIONS">
<varlistentry>
<term><emphasis role="bold">.PPC.EMB.sdata2</emphasis></term>
<listitem>
<para> This section holds initialized read-only small data that contributes
to the program memory image. The section can, however, be used to hold
writable data.</para>
<para>If a link editor creates a .PPC.EMB.sdata2 section that
combines a .PPC.EMB.sdata2 section whose sh_flags is SHF_ALLOC with a
.PPC.EMB.sdata2 section whose <varname>sh_flags</varname> is SHF_ALLOC + SHF_WRITE, then
the resulting .PPC.EMB.sdata2 section's <varname>sh_flags</varname> value shall be
SHF_ALLOC + SHF_WRITE. See <emphasis><xref linkend="SDATA2-AND-SBSS2-E500"></emphasis>
for more details.</para>
<informaltable frame="none">
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec colwidth='60' colname='c1' align="left">
<colspec colwidth='250' colname='c2' align="left">
<thead>
<row rowsep='1'>
<entry>Name</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>sh_name</entry>
<entry>.PPC.EMB.sdata2</entry>
</row>
<row>
<entry>sh_type</entry>
<entry>SHT_PROGBITS</entry>
</row>
<row>
<entry>sh_flags</entry>
<entry>SHF_ALLOC or</entry>
</row>
<row>
<entry></entry>
<entry> or</entry>
</row>
<row>
<entry></entry>
<entry>SHF_ALLOC + SHF_WRITE</entry>
</row>
<row>
<entry>sh_link</entry>
<entry>SHF_UNDEF</entry>
</row>
<row>
<entry>sh_addralign</entry>
<entry>Maximum alignment required by any data item in .PPC.EMB.sdata2</entry>
</row>
<row>
<entry>sh_info</entry>
<entry>0</entry>
</row>
<row>
<entry>sh_entsize</entry>
<entry>0</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">.PPC.EMB.sbss2</emphasis></term>
<listitem>
<para> The special section .PPC.EMB.sbss2 is intended to hold writable
small data that contribute to the program memory image and whose initial
values are 0. See <emphasis><xref linkend="SDATA2-AND-SBSS2-E500"></emphasis>
for more details.</para>
<informaltable frame="none">
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec colwidth='60' colname='c1' align="left">
<colspec colwidth='250' colname='c2' align="left">
<thead>
<row rowsep='1'>
<entry>Name</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>sh_name</entry>
<entry>.PPC.EMB.sbss2</entry>
</row>
<row>
<entry>sh_type</entry>
<entry>SHT_NOBITS</entry>
</row>
<row>
<entry>sh_flags</entry>
<entry>SHF_ALLOC + SHF_WRITE</entry>
</row>
<row>
<entry>sh_link</entry>
<entry>SHF_UNDEF</entry>
</row>
<row>
<entry>sh_addralign</entry>
<entry>Maximum alignment required by any data item in .PPC.EMB.sbss2.</entry>
</row>
<row>
<entry>sh_info</entry>
<entry>0</entry>
</row>
<row>
<entry>sh_entsize</entry>
<entry>0</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">.PPC.EMB.sdata0</emphasis></term>
<listitem>
<para> This section is intended to hold initialized small data that
contribute to the program memory image and whose addresses are all
within a 16-bit signed offset of address 0. See <emphasis><xref linkend="SDATA0-AND-SBSS0-E500"></emphasis>
for more details.</para>
<informaltable frame="none">
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec colwidth='60' colname='c1' align="left">
<colspec colwidth='250' colname='c2' align="left">
<thead>
<row rowsep='1'>
<entry>Name</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>sh_name</entry>
<entry>.PPC.EMB.sdata0</entry>
</row>
<row>
<entry>sh_type</entry>
<entry>SHT_PROGBITS</entry>
</row>
<row>
<entry>sh_flags</entry>
<entry>SHF_ALLOC + SHF_WRITE</entry>
</row>
<row>
<entry>sh_link</entry>
<entry>SHF_UNDEF</entry>
</row>
<row>
<entry>sh_addralign</entry>
<entry>Maximum alignment required by any data item in .PPC.EMB.sdata0</entry>
</row>
<row>
<entry>sh_info</entry>
<entry>0</entry>
</row>
<row>
<entry>sh_entsize</entry>
<entry>0</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">.PPC.EMB.sbss0</emphasis></term>
<listitem>
<para> This section is intended to hold small data that contribute to the
program memory image, whose addresses are all within a 16-bit signed offset of
address 0, and whose initial values are 0. See
<emphasis><xref linkend="SDATA0-AND-SBSS0-E500"></emphasis> for further
details.</para>
<informaltable frame="none">
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec colwidth='60' colname='c1' align="left">
<colspec colwidth='250' colname='c2' align="left">
<thead>
<row rowsep='1'>
<entry>Name</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>sh_name</entry>
<entry>.PPC.EMB.sbss0</entry>
</row>
<row>
<entry>sh_type</entry>
<entry>SHT_NOBITS</entry>
</row>
<row>
<entry>sh_flags</entry>
<entry>SHF_ALLOC + SHF_WRITE</entry>
</row>
<row>
<entry>sh_link</entry>
<entry>SHF_UNDEF</entry>
</row>
<row>
<entry>sh_addralign</entry>
<entry>Maximum alignment required by any data item in .PPC.EMB.sbss0.</entry>
</row>
<row>
<entry>sh_info</entry>
<entry>0</entry>
</row>
<row>
<entry>sh_entsize</entry>
<entry>0</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">.PPC.EMB.seginfo</emphasis></term>
<listitem>
<para> The special section .PPC.EMB.seginfo provides a means of naming
and providing additional information about ELF segments (which are described by
ELF program header table entries). A file shall contain at most one section
named .PPC.EMB.seginfo. See <emphasis><xref linkend="ROM-COPY-SEGMENT-INFORMATION-SECTION"></emphasis> for more details.</para>
<informaltable frame="none">
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec colwidth='60' colname='c1' align="left">
<colspec colwidth='250' colname='c2' align="left">
<thead>
<row rowsep='1'>
<entry>Name</entry>
<entry>Value</entry>
</row>
</thead>
<tbody>
<row>
<entry>sh_name</entry>
<entry>.PPC.EMB.seginfo</entry>
</row>
<row>
<entry>sh_type</entry>
<entry>SHT_PROGBITS</entry>
</row>
<row>
<entry>sh_flags</entry>
<entry>0</entry>
</row>
<row>
<entry>sh_link</entry>
<entry>SHF_UNDEF</entry>
</row>
<row>
<entry></entry>
<entry> or</entry>
</row>
<row>
<entry></entry>
<entry>The section header table index of a section of type SHT_STRTAB whose string table contains the null terminated names to which entries in .PPC.EMB.seginfo refer.</entry>
</row>
<row>
<entry>sh_addr</entry>
<entry>0</entry>
</row>
<row>
<entry>sh_addralign</entry>
<entry>0</entry>
</row>
<row>
<entry>sh_info</entry>
<entry>0</entry>
</row>
<row>
<entry>sh_entsize</entry>
<entry>12</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</varlistentry>
</variablelist>
</sect1>
<sect1 id="SYMBOL-TABLE">
<title>Symbol Table</title>
<sect2 id="SYMBOL-VALUES"><title>Symbol Values</title>
<para>An executable file that contains a symbol reference that is to be resolved dynamically by
an associated shared object will have a symbol table entry for that symbol. This entry will
identify the symbol as undefined by setting the <emphasis role="bold">st_shndx</emphasis> member
to <emphasis role="bold">SHN_UNDEF</emphasis>.</para>
<para>An executable file that needs to compare the value of two symbol references will have a
symbol table entry for that symbol where the <emphasis role="bold">st_value</emphasis> member is
nonzero.</para>
<para>If the <emphasis role="bold">st_value</emphasis> of an undefined symbol is nonzero, the
loader must resolve every reference to the named symbol to the same value. This insures that
all pointers to the symbol will be identical. If <emphasis role="bold">st_value</emphasis> is
zero, the loader may resolve these symbols to different values, for example, to point directly
to the symbol in some cases or into the GOT in other cases. If no PLT entry is allocated for
the symbol, then <emphasis role="bold">st_value</emphasis> is zero.</para>
<para CONDITION="ATR-SECURE-PLT">Under the Secure-PLT ABI, if a PLT entry is allocated for a
symbol reference in the executable file the value of this <emphasis
role="bold">st_value</emphasis> member is the address of an executable PLT call code stub. This
executable stub is used for branching to the virtual address held by the nonexecutable PLT
entry for the symbol. The content of the PLT entry defaults to the address of a PLT symbol
resolver stub, which will direct the dynamic linker to resolve the reference to the symbol.
Following resolution the PLT entry holds the absolute virtual address of the symbol.</para>
<para CONDITION="ATR-BSS-PLT">Under the BSS-PLT ABI this <emphasis
role="bold">st_value</emphasis> member holds the R_PPC_REL32 relocated address into the <emphasis
role="bold">.plt</emphasis> section for the PLT entry used to resolve the undefined symbol.
This PLT entry contains executable code used to dynamically resolve the address of the target
symbol. The number of instructions in this code stub varies on the distance to the
target.</para>
<para>Referencing GOT nonlocal statics is shown in <xref
linkend="SMALL-MODEL-POS-IND-LOAD-STORE"> and <xref linkend="LARGE-MODEL-POS-IND-LOAD-STORE">.
Taking the address of nonstatic function pointers is indicated by
<varname><symbol>@plt</varname>. <xref linkend="SMALL-MODEL-PIC-CALL"> and <xref
linkend="LARGE-MODEL-PIC-CALL"> demonstrate how to perform this action.</para>
</sect2>
</sect1>
<sect1 id="SMALL-DATA-AREA" CONDITION="!ATR-EABI">
<title>Small Data Area</title>
<para>The <emphasis>small data area</emphasis> resides within the <emphasis>Data segment</emphasis>. It is composed of the
.sdata and .sbss sections which contain initialized and uninitialized data items, respectively. The data items
in these sections are addressed by 16-bit signed offsets with respect to the base of the small data
area.</para>
<para>The use of small data areas for data items typically results in smaller programs and faster program execution.</para>
<para>The small data area is adjacent to the initialized and uninitialized data in the Data segment of both executables and shared objects.</para>
<para CONDITION="ATR-BSS-PLT">The typical order of sections in the Data segment (some possibly empty) under the BSS-PLT ABI is shown in <emphasis><xref linkend="BSS-PLT-SECTION-ORDERING"></emphasis>.
<figure id="BSS-PLT-SECTION-ORDERING">
<title>Section Ordering Under the BSS-PLT</title>
<screen>
.data
.got
.sdata
.sbss
.plt
.bss</screen>
</figure></para>
<para CONDITION="ATR-SECURE-PLT">Under the Secure-PLT ABI, for security reasons, the .got and .plt may be
marked read-only after relocation, which requires placing the .got and .plt with other sections that are
similarly made read-only after relocation, before sections that remain read-write as shown in
<emphasis><xref linkend="SECURE-PLT-SECTION-ORDERING"></emphasis>. If an implementation does not mark the .got and .plt sections as read-only after relocation it may still reorder the sections as indicated or it may use the section layout as described in <emphasis><xref linkend="BSS-PLT-SECTION-ORDERING"></emphasis>. See <emphasis><xref linkend="SECURE-PLT"></emphasis> for information on the Secure-PLT ABI.
<figure id="SECURE-PLT-SECTION-ORDERING">
<title>Section Ordering Under the Secure-PLT</title>
<screen>
.got
.plt
.data
.sdata
.sbss
.bss</screen>
</figure></para>
<para>The size of the small data area is limited. A data item is placed in the small data area by
a compiler that supports small data relative addressing based on its size. All data items up to a
certain specified size (with 8 bytes being the typical default size) are placed into the small data
area.</para>
<para>The link editor fails to build the executable file or shared object file if the
default or specified size for the placement of items into the small data area results in the small data
area being too large to be addressed with 16-bit relative offsets. In such a situation, recompilation
with a smaller value for the size criterion must be done.</para>
<sect2 id="SMALL-DATA-AREA-FOR-EXECUTABLES">
<title>Use of the Small Data Area in Executables</title>
<para>In the case of executable files, the small data area may contain up to 64 KB of data
items with local or global scope. The link editor defines the symbol
<varname>_SDA_BASE_</varname> (small data area base) to be an address relative to which all data
in the .sdata and .sbss sections may be addressed with 16-bit signed offsets. In case there
is not a .sdata or a .sbss section, the symbol <varname>_SDA_BASE_</varname> is defined to be
0.</para>
<para>For a data item in the .sdata or .sbss sections, a compiler may generate short-form one
instruction references. In an executable file, such a reference is relative to the address of
<varname>_SDA_BASE_</varname> symbol, which is held in the small data area pointer register,
r13.</para>
<para>At process initialization time, r13 is loaded with the
value of the symbol <varname>_SDA_BASE_</varname>. General-purpose register r13 retains this value subsequently, i.e., its
contents remain intact. </para>
</sect2>
<sect2 id="SMALL-DATA-AREA-FOR-SHARED-OBJECTS" CONDITION="ATR-BSS-PLT">
<title>Use of the Small Data Area in Shared Objects</title>
<para CONDITION="ATR-SECURE-PLT">In a shared object under the Secure-PLT ABI, addressing .sdata
and .sbss using short (16-bit) offsets is not supported and therefore using the small data area
in shared objects is not supported, which is a change from the SYSV ABI.</para>
<para>Because the small data area follows the <emphasis><link linkend="GLOBAL-OFFSET-TABLE">Global Offset Table</link></emphasis> in a shared object, the data in
the small data area can be addressed relative to the GOT pointer. For each shared object, the
symbol <varname>_SDA_BASE_</varname> shall have the same value possessed by the symbol
<varname>_GLOBAL_OFFSET_TABLE_</varname>.</para>
<para>Since the small data area pointer register, r13, holds the value of the executable file's
<varname>_SDA_BASE_</varname> symbol, a shared object may not modify r13 and should not attempt to use
it for referencing the shared object's small data area.</para>
<para>The <varname>_GLOBAL_OFFSET_TABLE_</varname> and <varname>_SDA_BASE_</varname> symbols are
relative to each shared object and therefore the small data area of a shared object may only
contain data items having local (i.e., non global) scope.</para>
<para>When <varname>_GLOBAL_OFFSET_TABLE_</varname> relative addressing is used in a shared
object to access the small data area, the size of the small data area can be 32 KB at the
maximum, although it can be less if it happens that the <emphasis><link linkend="GLOBAL-OFFSET-TABLE">Global Offset Table</link></emphasis> is large.</para>
<para>A compiler may generate short-form one instruction references relative to a register
that contains the address of the shared object's <varname>_SDA_BASE_</varname> symbol.</para>
</sect2>
<!-- <para>The small data segment of a shared object may only contain data items having local (i.e.
nonglobal) scope.</para> -->
</sect1>
<sect1 CONDITION="ATR-EABI" id="SMALL-DATA-AREA-E500">
<title>EABI Small Data Areas</title>
<para>Three distinct small data areas, each possibly containing both initialized and zero-initialized data, are supported by the Embedded
ABI, and are summarized in the following table.</para>
<table id="EABI-SMALL-DATA-AREAS-SUMMARY" frame="none"><title>EABI Small Data Areas Summary</title>
<tgroup cols='4' colsep='0' rowsep='0'>
<colspec colwidth='100' colname='c1' align="left">
<colspec colwidth='80' colname='c2' align="left">
<colspec colwidth='80' colname='c3' align="left">
<colspec colwidth='100' colname='c4' align="left">
<thead>
<row>
<entry namest="c1" rowsep='1'>Section Names</entry>
<entry namest="c2" rowsep='1'>Register or Value</entry>
<entry namest="c3" rowsep='1'>Symbol</entry>
<entry namest="c4" rowsep='1'>Shared Object Addressability?</entry>
</row>
</thead>
<tbody>
<row>
<entry namest="c1">.sdata</entry>
<entry namest="c2">r13</entry>
<entry namest="c3"><varname>_SDA_BASE_</varname></entry>
<entry namest="c4">local data only</entry>
</row>
<row>
<entry namest="c1" nameend="c4" rowsep='1'>.sbss</entry>
</row>
<row>
<entry namest="c1">.PPC.EMB.sdata2</entry>
<entry namest="c2">r2</entry>
<entry namest="c3"><varname>_SDA2_BASE_</varname></entry>
<entry namest="c4">no</entry>
</row>
<row>
<entry namest="c1" nameend="c4" rowsep='1'>.PPC.EMB.sbss2</entry>
</row>
<row>
<entry namest="c1">.PPC.EMB.sdata0</entry>
<entry namest="c2">0</entry>
<entry namest="c3">n/a</entry>
<entry namest="c4">no</entry>
</row>
<row>
<entry namest="c1" nameend="c4" rowsep='1'>.PPC.EMB.sbss0</entry>
</row>
</tbody>
</tgroup>
</table>
<para>In both shared objects and executables, the small data areas straddle the boundary between initialized and
uninitialized data in the Data segment. The usual order of sections in the Data segment, some of which may be
empty, is shown in <xref linkend="EABI-SECTION-ORDERING">.</para>
<figure id="EABI-SECTION-ORDERING"><title>Section Ordering In the EABI</title>
<screen>
.rodata
.PPC.EMB.sdata2
.PPC.EMB.sbss2
.data
.got
.sdata
.sbss
.plt
.bss</screen></figure>
<para>All three small data areas can contain at most 64 KB of data items. All areas may hold both local
and global data items in executables. In shared objects, .sdata/.sbss may only hold local data
items, and the other two areas are not permitted. These areas are not permitted to hold values that
might be changed outside of the program (that is, volatile variables). </para>
<para>Compilers may generate short-form, one-instruction references with 16-bit offsets for all data items that are in these six
sections. Placing more data items in small data areas usually results in smaller and faster program execution.</para>
<para>These areas together provide up to 192 KB of data items that can be addressed in a single
instruction: two 64-KB regions that can be placed anywhere in the address space but typically in
standard locations (see <emphasis><xref linkend="SDATA-AND-SBSS-E500"></emphasis>), and one 64 KB region straddling address 0 (32 KB at
addresses 0xFFFF_8000 through 0xFFFF_FFFF, and 32 KB at addresses 0x0000_0000 through
0x0000_7FFF).</para>
<para>Because the sizes of these areas are limited, compilers that support small data area relative
addressing typically determine whether or not an eligible data item is placed in the small data area
based on its size. Under this scheme, all data items less than or equal to a specified size (the default
is usually 8 bytes) are placed in the small data area. Initialized data items are placed in one of the
.data sections, uninitialized data items in one of the .sbss sections. If the default size results in
a small data area that is too large to be addressed with 16-bit relative offsets, the link editor fails
to build the executable file or shared object file, and some of the code that makes up the file must be recompiled
with a smaller value for the size criterion. </para>
<para>This ABI does not preclude a compiler from using profiling information or some form of heuristics, rather than purely
data item size, to make more informed decisions about which data items should be placed in these regions.</para>
<sect2 id="SDATA-AND-SBSS-E500">
<title>Small Data Area (.sdata and .sbss)</title>
<para>The small data area is part of the data segment of an executable program. It contains data items within the .sdata and
.sbss sections, which can be addressed with 16-bit signed offsets from the base of the small data area.</para>
<para>Only data items with local (nonglobal) scope may appear in the small data area of a
shared object. In a shared object the small data area follows the <emphasis><link linkend="GLOBAL-OFFSET-TABLE">Global Offset Table</link></emphasis>, so data
in the small data area can be addressed relative to the GOT pointer. However, in this case, the
small data area is limited in size to no more than 32 KB, and less if the global offset
table is large.</para>
<para>For executable files, up to 64 KB of data items with local or global scope can be
placed into the small data area. In an executable file, the symbol <varname>_SDA_BASE_</varname>
(small data area base) is defined by the link editor to be an address relative to which all data
in the .sdata and .sbss sections can be addressed with 16-bit signed offsets or, if there is
neither a .sdata nor a .sbss section, the value 0. In a shared object,
<varname>_SDA_BASE_</varname> is defined to have the same value as
<varname>_GLOBAL_OFFSET_TABLE_</varname>. The value of <varname>_SDA_BASE_</varname> in an
executable is normally loaded into r13 at process initialization time, and r13 thereafter
remains unchanged. In particular, shared objects shall not change the value in r13.</para>
<para>In executables, references to data items in the .sdata or .sbss sections are relative to r13; in shared objects,
they are relative to a register that contains the address of the <emphasis><link linkend="GLOBAL-OFFSET-TABLE">Global Offset Table</link></emphasis>.</para>
</sect2>
<sect2 id="SDATA2-AND-SBSS2-E500">