-
Notifications
You must be signed in to change notification settings - Fork 8
/
libelf.vapi
1698 lines (1695 loc) · 32.8 KB
/
libelf.vapi
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
[CCode (cheader_filename = "libelf.h")]
namespace Elf {
/**
* Magic number byte 0
*/
[CCode (cname = "ELFMAG0")]
public const uint8 MAG0;
/**
* Magic number byte 1
*/
[CCode (cname = "ELFMAG1")]
public const uint8 MAG1;
/**
* Magic number byte 2
*/
[CCode (cname = "ELFMAG2")]
public const uint8 MAG2;
/**
* Magic number byte 3
*/
[CCode (cname = "ELFMAG3")]
public const uint8 MAG3;
/**
* Get error code of last failing function call.
*
* This value is kept separately for each thread.
*/
[CCode (cname = "elf_errno")]
public int errno ();
/**
* Get error string.
*
* @param error If zero, return error string for most recent error or null is none occurred. If -1 the behaviour is similar to the last case except that not null but a legal string is returned.
*/
[CCode (cname = "elf_errmsg")]
public unowned string? errmsg (int error);
/**
* Set fill bytes used to fill holes in data structures.
*/
[CCode (cname = "elf_fill")]
public void fill (int fill);
/**
* Compute hash value.
*/
[CCode (cname = "elf_hash")]
public ulong hash (string str);
/**
* Coordinate ELF library and application versions.
*/
[CCode (cname = "elf_version")]
public Version version (Version version = Version.CURRENT);
}
/**
* Descriptor for the ELF file.
*/
[CCode (cname = "Elf", free_function = "elf_end")]
[Compact]
public class Elf.Desc {
public archive_header? archive_header {
[CCode (cname = "elf_getarhdr")]
get;
}
/**
* Get the base offset for an object file.
*/
public Posix.off_t base_offset {
[CCode (cname = "elf_getbase")]
get;
}
/**
* Simple checksum from permanent parts of the ELF file.
*/
public long checksum {
[CCode (cname = "elf32_checksum")]
get;
}
/**
* Simple checksum from permanent parts of the ELF file using ELFCLASS64.
*/
public long checksum64 {
[CCode (cname = "elf64_checksum")]
get;
}
public hdr32? header {
[CCode (cname = "elf32_getehdr")]
get;
}
public hdr64? header64 {
[CCode (cname = "elf64_getehdr")]
get;
}
public uint8[] ident {
[CCode (cname = "elf_getident", array_length_type = "size_t")]
get;
}
/**
* The kind of file.
*/
public Elf.Kind kind {
[CCode (cname = "elf_kind")]
get;
}
public program_header? program_header {
[CCode (cname = "elf32_getphdr")]
get;
}
public program_header64? program_header64 {
[CCode (cname = "elf64_getphdr")]
get;
}
/**
* An uninterpreted byte image of the file.
*
* This should be used only to retrieve a file being read.
*
* A program may not close or disable the associated file descriptor the initial access, because the data might have to be read from the file if it does not already have the original bytes in memory. Generally, this function is more efficient for unknown file types than for object files. The library implicitly translates object files in memory, while it leaves unknown files unmodified. Thus, asking for the uninterpreted image of an object file may create a duplicate copy in memory.
* @see control
*/
public uint8[] raw {
[CCode (cname = "elf_rawfile")]
get;
}
/**
* Get descriptor for ELF file to manipulate.
* @param filedes the file descriptor of the open file
* @param cmd the type of actions that will be performed. This must match the state of the file descriptor.
* @param ar_parent if provided, this is an ar(1) archive to browse
*/
[CCode (cname = "elf_begin")]
public static Desc? open (int filedes, Elf.Command cmd, Desc? ar_parent = null);
/**
* Create descriptor for memory region.
*/
[CCode (cname = "elf_memory")]
public static Desc? open_memory ([CCode (array_length_type = "size_t")] uint8[] image);
/**
* Create a clone of an existing descriptor.
*/
[CCode (cname = "elf_clone")]
public Desc clone (Elf.Command cmd);
/**
* Control the file descriptor.
* @param cmd when {@link Command.FDDONE}, it tells the library not to use the file descriptor. This is usefl when a program has requested all the required information. When {@link Command.FDREAD}, it forces the library to read the contents of the file so that it might close the descriptor.
*/
[CCode (cname = "elf_cntl")]
public bool control (Command cmd);
/**
* Behaves like {@link header}, but creates a header if one does not exist
*/
[CCode (cname = "elf32_newehdr")]
public hdr32? create_header ();
/**
* Behaves like {@link header64}, but creates a header if one does not exist
*/
[CCode (cname = "elf64_newehdr")]
public hdr64? create_header64 ();
/**
* Create a new program header, discarding the previous one of it exists.
* @param count the number of entries in the header
*/
[CCode (cname = "elf32_newphdr")]
public program_header? create_program_header (size_t count);
/**
* Create a new program header, discarding the previous one of it exists.
* @param count the number of entries in the header
*/
[CCode (cname = "elf64_newphdr")]
public program_header? create_program_header64 (size_t count);
/**
* Create a new section and append it.
*/
[CCode (cname = "elf_newscn")]
public Section? create_section ();
/**
* Get an elf section.
*
* Note that {@link Elf.Section.UNDEF} is always present, but uninteresting.
*/
[CCode (cname = "elf_getscn")]
public Section? get (size_t index);
[CCode (cname = "elf_getarsym")]
public ar_symbol? get_ar_symbol (out size_t length);
/**
* Get the number of programs.
* @return false on success
*/
[CCode (cname = "elf_getphdrnum")]
public bool get_num_programs (out size_t num);
/**
* Get the number of sections.
* @return false on success
*/
[CCode (cname = "elf_getshdrnum")]
public bool get_num_sections (out size_t num);
/**
* Converts a string section offset to a string.
*
* This identifies the file in which the string section resides, and the section table index for the strings.
* @return normally a string, but null pointer when the section is invalid or is not a section of type {@link SectionType.STRTAB}, the section data cannot be obtained, offset is invalid, or an error occurs.
*/
[CCode (cname = "elf_strptr")]
public unowned string? get_string (size_t section, size_t offset);
/**
* Get the index of the string table.
* @return false on success
*/
[CCode (cname = "elf_getshdrstrndx")]
public bool get_string_section (out size_t index);
/**
* Move a section
*
* The application is responsible for updating data.
* @param scn the section to move
* @param after the section to place the moved section after
* @return the original index of the removed section. Zero indicates an error.
*/
[CCode (cname = "elfx_movscn")]
public size_t move_section (Section scn, Section after);
/**
* Advance archive descriptor to next element.
*
* This is only useful when opened from a parent descriptor.
*/
[CCode (cname = "elf_next")]
public Elf.Command next ();
[CCode (cname = "elf_nextscn")]
public unowned Section? next_section (Section? section = null);
/**
* Allow random archive processing, preparing to access an arbitrary archive member.
*
* The object must be a descriptor for the archive itself, not a member within the archive.
*
* A program can mix random and sequential archive processing.
* @param offset specifies the byte offset from the beginning of the archive to the archive header of the desired member.
* @return on success, it returns offset. Otherwise, it returns 0, because an error occurred, or the file was not an archive (no archive member can have a zero offset).
* @see get_ar_symbol
*/
[CCode (cname = "elf_rand")]
public size_t rand (size_t offset);
/**
* Remove a section.
* @return the original index of the removed section. Zero indicates an error.
*/
[CCode (cname = "elfx_remscn")]
public size_t remove_section (owned Section scn);
/**
* Set the string table index.
* @return false on success
* @see get_string_section
*/
[CCode (cname = "elfx_update_shstrndx")]
public bool set_string_section (size_t index);
/**
* Causes the library to examine the information associated with an ELF descriptor, and to recalculate the structural data needed to generate the file's image.
*
* @param cmd When {@link Command.NULL}, it recalculates various values, updating only the ELF descriptor's memory structures. Any modified structures are flagged with the {@link Flag.DIRTY} bit. A program thus can update the structural information and then reexamine them without changing the file associated with the ELF descriptor. Because this does not change the file, the ELF descriptor may allow reading, writing, or both reading and writing. When {@link Command.WRITE}, it duplicates its {@link Command.NULL} actions and also writes any dirty information associated with the ELF descriptor to the file. That is, when a program has used {@link get} or the various ''update_flags'' facilities to supply new (or update existing) information for an ELF descriptor, those data will be examined, coordinated, translated if necessary, and written to the file. When portions of the file are written, any {@link Flag.DIRTY} bits are reset, indicating those items no longer need to be written to the file. The sections' data are written in the order of their section header entries, and the section header table is written to the end of the file. When the ELF descriptor was created, it must have allowed writing the file.
* @return If successful, it returns the total size of the file image (not the memory image), in bytes. Otherwise an error occurred, and the function returns -1.
*/
[CCode (cname = "elf_update")]
public Posix.off_t update (Command cmd = Command.NULL);
[CCode (cname = "elf_flagelf")]
public Flag update_elf_flag (Command cmd, Flag flags);
[CCode (cname = "elf_flagehdr")]
public Flag update_elf_header_flags (Command cmd, Flag flags);
[CCode (cname = "elf_flagphdr")]
public Flag update_phdr_flag (Command cmd, Flag flags);
}
/*
* Section descriptor
*/
[CCode (cname = "Elf_Scn")]
public class Elf.Section {
public section_header? header {
[CCode (cname = "elf32_getshdr")]
get;
}
public section_header64? header64 {
[CCode (cname = "elf64_getshdr")]
get;
}
/**
* Section table index
*/
public size_t index {
[CCode (cname = "elf_ndxscn")]
get;
}
/**
* Creates a new data descriptor for a section, appending it to any data elements already associated with the section.
*
* The new data descriptor appears empty, indicating the element holds no data. For convenience, the descriptor's type is set to {@link Type.BYTE}, and the version is set to the working version. The program is responsible for setting (or changing) the descriptor members as needed. This function implicitly sets the {@link Flag.DIRTY} bit for the section's data.
*/
[CCode (cname = "elf_newdata")]
public data? create_data ();
/**
* Get a data block assoicated with this section.
* @param previous the block preceeding the desired block, or null for the first
*/
[CCode (cname = "elf_getdata")]
public data? get_data (data? previous = null);
/**
* Get a datablock without interpreted bytes, regardless of the section type.
*
* This function typically should be used only to retrieve a section image from a file being read, and then only when a program must avoid the automatic data translation described below. Moreover, a program may not close or disable (see {@link Desc.control}) the file descriptor associated with elf before the initial raw operation, because this method might read the data from the file to ensure it doesn't interfere with {@link get_data}.
*
* See {@link Desc.raw} for a related facility that applies to the entire file. When {@link get_data} provides the right translation, its use is recommended.
*/
[CCode (cname = "elf_rawdata")]
public data? get_raw_data (data? previous = null);
[CCode (cname = "elf_flagshdr")]
public Flag update_header_flags (Command cmd, Flag flags);
[CCode (cname = "elf_flagscn")]
public Flag update_flags (Command cmd, Flag flags);
/**
* Undefined section
*/
[CCode (cname = "SHN_UNDEF")]
public const size_t UNDEF;
/**
* Start of reserved indices
*/
[CCode (cname = "SHN_LORESERVE")]
public const size_t LORESERVE;
/**
* Start of processor-specific
*/
[CCode (cname = "SHN_LOPROC")]
public const size_t LOPROC;
/**
* Order section before all others (Solaris).
*/
[CCode (cname = "SHN_BEFORE")]
public const size_t BEFORE;
/**
* Order section after all others (Solaris).
*/
[CCode (cname = "SHN_AFTER")]
public const size_t AFTER;
/**
* End of processor-specific
*/
[CCode (cname = "SHN_HIPROC")]
public const size_t HIPROC;
/**
* Start of OS-specific
*/
[CCode (cname = "SHN_LOOS")]
public const size_t LOOS;
/**
* End of OS-specific
*/
[CCode (cname = "SHN_HIOS")]
public const size_t HIOS;
/**
* Associated symbol is absolute
*/
[CCode (cname = "SHN_ABS")]
public const size_t ABS;
/**
* Associated symbol is common
*/
[CCode (cname = "SHN_COMMON")]
public const size_t COMMON;
/**
* Index is in extra table.
*/
[CCode (cname = "SHN_XINDEX")]
public const size_t XINDEX;
/**
* End of reserved indices
*/
[CCode (cname = "SHN_HIRESERVE")]
public const size_t HIRESERVE;
}
/**
* Archive symbol table entry
*/
[CCode (cname = "Elf_Arsym")]
public struct Elf.ar_symbol {
/**
* Symbol name.
*/
[CCode (cname = "as_name")]
string name;
/**
* Offset for this file in the archive.
*/
[CCode (cname = "as_off")]
size_t off;
/**
* Hash value of the name.
*/
[CCode (cname = "as_hash")]
ulong hash;
}
/**
* Archive member header
*/
[CCode (cname = "Elf_Arhdr")]
public struct Elf.archive_header {
/**
* An archive member name, is a string, with the ar format control characters removed.
* @see raw_name
*/
[CCode (cname = "ar_name")]
string name;
/**
* File date.
*/
[CCode (cname = "ar_date")]
time_t date;
/**
* User ID.
*/
[CCode (cname = "ar_uid")]
long uid;
/**
* Group ID.
*/
[CCode (cname = "ar_gid")]
long gid;
/**
* File mode.
*/
[CCode (cname = "ar_mode")]
ulong mode;
/**
* File size.
*/
[CCode (cname = "ar_size")]
Posix.off_t size;
/**
* Holds a string that represents the original name bytes in the file, including the terminating slash and trailing blanks as specified in the archive format.
* In addition to regular archive members, the archive format defines some special members. All special member names begin with a slash (/), distinguishing them from regular members (whose names may not contain a slash).
*
* * A single slash is the archive symbol table. If present, it will be the first archive member. A program may access the archive symbol table through {@link Desc.get_ar_symbol}. The information in the symbol table is useful for random archive processing (see {@link Desc.rand}).
* * A double slash member, if present, holds a string table for long archive member names. An archive member's header contains a 16-byte area for the name, which may be exceeded in some file systems.
*/
[CCode (cname = "ar_rawname")]
string raw_name;
}
/**
* Data converted to/from memory format
*/
[CCode (cname = "Elf_Data", destroy_function = "")]
public struct Elf.data {
[CCode (cname = "d_buf", array_length_cname = "d_size")]
public uint8[] buf;
[CCode (cname = "d_type")]
public Type type;
[CCode (cname = "d_off")]
public Posix.off_t offset;
[CCode (cname = "d_align")]
public size_t align;
[CCode (cname = "d_version")]
public Version version;
[CCode (cname = "elf32_xlatetof", instance_pos = 1.1)]
public bool from_memory (out data dst, Encoding encode);
[CCode (cname = "elf32_xlatetom", instance_pos = 1.1)]
public bool to_memory (out data dst, Encoding encode);
[CCode (cname = "elf64_xlatetof", instance_pos = 1.1)]
public bool from_memory64 (out data dst, Encoding encode);
[CCode (cname = "elf64_xlatetom", instance_pos = 1.1)]
public bool to_memory64 (out data dst, Encoding encode);
[CCode (cname = "elf_flagdata")]
public Flag update_flags (Command cmd, Flag flags);
}
/* The ELF file header. This appears at the start of every ELF file. */
[CCode (cname = "Elf32_Ehdr")]
public struct Elf.hdr32 {
/**
* Magic number
*/
[CCode (cname = "e_ident", array_length_cexpr = "EI_NIDENT")]
char[] ident;
[CCode (cname = "e_type")]
ObjType type;
[CCode (cname = "e_machine")]
Machine machine;
[CCode (cname = "e_version")]
Version version;
/**
* Entry point virtual address
*/
[CCode (cname = "e_entry")]
uint32 entry;
/**
* Program header table file offset
*/
[CCode (cname = "e_phoff")]
uint32 program_header_offset;
/**
* Section header table file offset
*/
[CCode (cname = "e_shoff")]
uint32 section_header_offset;
/**
* Processor-specific flags
*/
[CCode (cname = "e_flags")]
uint32 flags;
/**
* ELF header size in bytes
*/
[CCode (cname = "e_ehsize")]
uint16 header_size;
/**
* Program header table entry size
*/
[CCode (cname = "e_phentsize")]
uint16 program_entry_size;
/**
* Program header table entry count
*/
[CCode (cname = "e_phnum")]
uint16 program_count;
/**
* Section header table entry size
*/
[CCode (cname = "e_shentsize")]
uint16 section_header_size;
/**
* Section header table entry count
*/
[CCode (cname = "e_shnum")]
uint16 section_count;
/**
* Section header string table index
*/
[CCode (cname = "e_shstrndx")]
uint16 string_index;
}
[CCode (cname = "Elf64_Ehdr")]
public struct Elf.hdr64 {
/**
* Magic number
*/
[CCode (cname = "e_ident", array_length_cexpr = "EI_NIDENT")]
char[] ident;
[CCode (cname = "e_type")]
ObjType type;
[CCode (cname = "e_machine")]
Machine machine;
[CCode (cname = "e_version")]
Version version;
/**
* Entry point virtual address
*/
[CCode (cname = "e_entry")]
uint64 entry;
/**
* Program header table file offset
*/
[CCode (cname = "e_phoff")]
uint64 program_header_offset;
/**
* Section header table file offset
*/
[CCode (cname = "e_shoff")]
uint64 section_header_offset;
/**
* Processor-specific flags
*/
[CCode (cname = "e_flags")]
uint32 flags;
/**
* ELF header size in bytes
*/
[CCode (cname = "e_ehsize")]
uint16 header_size;
/**
* Program header table entry size
*/
[CCode (cname = "e_phentsize")]
uint16 program_entry_size;
/**
* Program header table entry count
*/
[CCode (cname = "e_phnum")]
uint16 program_count;
/**
* Section header table entry size
*/
[CCode (cname = "e_shentsize")]
uint16 section_header_size;
/**
* Section header table entry count
*/
[CCode (cname = "e_shnum")]
uint16 section_count;
/**
* Section header string table index
*/
[CCode (cname = "e_shstrndx")]
uint16 string_index;
[CCode (cname = "e_ident[EI_CLASS]")]
public Class @class;
[CCode (cname = "e_ident[EI_DATA]")]
public Encoding encoding;
[CCode (cname = "e_ident[EI_VERSION]")]
public Version abi_version;
[CCode (cname = "e_ident[EI_OSABI]")]
public OsAbi abi;
}
[CCode (cname = "Elf32_Phdr")]
public struct Elf.program_header {
[CCode (cname = "p_type")]
ProgType type;
/**
* Segment file offset
*/
[CCode (cname = "p_offset")]
uint32 offset;
/**
* Segment virtual address
*/
[CCode (cname = "p_vaddr")]
uint32 virtual_addr;
/**
* Segment physical address
*/
[CCode (cname = "p_paddr")]
uint32 physical_addr;
/**
* Segment size in file
*/
[CCode (cname = "p_filesz")]
uint32 file_size;
/**
* Segment size in memory
*/
[CCode (cname = "p_memsz")]
uint32 memory_Size;
[CCode (cname = "p_flags")]
SegmentFlag flags;
/**
* Segment alignment
*/
[CCode (cname = "p_align")]
uint32 align;
}
[CCode (cname = "Elf64_Phdr")]
public struct Elf.program_header64 {
[CCode (cname = "p_type")]
ProgType type;
/**
* Segment file offset
*/
[CCode (cname = "p_offset")]
uint64 offset;
/**
* Segment virtual address
*/
[CCode (cname = "p_vaddr")]
uint64 virtual_addr;
/**
* Segment physical address
*/
[CCode (cname = "p_paddr")]
uint64 physical_addr;
/**
* Segment size in file
*/
[CCode (cname = "p_filesz")]
uint64 file_size;
/**
* Segment size in memory
*/
[CCode (cname = "p_memsz")]
uint64 memory_Size;
[CCode (cname = "p_flags")]
SegmentFlag flags;
/**
* Segment alignment
*/
[CCode (cname = "p_align")]
uint64 align;
}
[CCode (cname = "Elf32_Shdr")]
public struct Elf.section_header {
/**
* Section name (string table index)
*/
[CCode (cname = "sh_name")]
uint32 name;
[CCode (cname = "sh_type")]
SectionType type;
[CCode (cname = "sh_flags")]
SectionFlag flags;
/**
* Section virtual addr at execution
*/
[CCode (cname = "sh_addr")]
uint32 addr;
/**
* Section file offset
*/
[CCode (cname = "sh_offset")]
uint32 offset;
/**
* Section size in bytes
*/
[CCode (cname = "sh_size")]
uint32 size;
/**
* Link to another section
*/
[CCode (cname = "sh_link")]
uint32 link;
/**
* Additional section information
*/
[CCode (cname = "sh_info")]
uint32 info;
/**
* Section alignment
*/
[CCode (cname = "sh_addralign")]
uint32 addralign;
/**
* Entry size if section holds table
*/
[CCode (cname = "sh_entsize")]
uint32 entsize;
}
[CCode (cname = "Elf64_Shdr")]
public struct Elf.section_header64 {
/**
* Section name (string table index)
*/
[CCode (cname = "sh_name")]
uint32 name;
[CCode (cname = "sh_type")]
SectionType type;
[CCode (cname = "sh_flags")]
SectionFlag flags;
/**
* Section virtual addr at execution
*/
[CCode (cname = "sh_addr")]
uint64 addr;
/**
* Section file offset
*/
[CCode (cname = "sh_offset")]
uint64 offset;
/**
* Section size in bytes
*/
[CCode (cname = "sh_size")]
uint64 size;
/**
* Link to another section
*/
[CCode (cname = "sh_link")]
uint64 link;
/**
* Additional section information
*/
[CCode (cname = "sh_info")]
uint64 info;
/**
* Section alignment
*/
[CCode (cname = "sh_addralign")]
uint64 addralign;
/**
* Entry size if section holds table
*/
[CCode (cname = "sh_entsize")]
uint64 entsize;
}
[CCode (cname = "int")]
public enum Elf.Class {
[CCode (cname = "ELFCLASSNONE")]
NONE,
[CCode (cname = "ELFCLASS32")]
THIRTY_TWO,
[CCode (cname = "ELFCLASS64")]
SIXTY_FOUR
}
[CCode (cname = "Elf_Cmd", cprefix = "ELF_C_")]
public enum Elf.Command {
/**
* Nothing, terminate, or compute only.
*/
NULL,
/**
* Read.
*/
READ,
/**
* Read and write.
*/
RDWR,
/**
* Write.
*/
WRITE,
/**
* Clear flag.
*/
CLR,
/**
* Set flag.
*/
SET,
/**
* Signal that file descriptor will not be used anymore.
*/
FDDONE,
/**
* Read rest of data so that file descriptor is not used anymore.
*/
FDREAD,
/**
* Read, but mmap the file if possible.
*/
READ_MMAP,
/**
* Read and write, with mmap.
*/
RDWR_MMAP,
/**
* Write, with mmap.
*/
WRITE_MMAP,
/**
* Read, but memory is writable, results are not written to the file.
*/
READ_MMAP_PRIVATE,
/**
* Copy basic file data but not the content.
*/
EMPTY
}
[CCode (cname = "int", cprefix = "ELFDATA")]
public enum Elf.Encoding {
/**
* Invalid data encoding
*/
NONE,
/**
* 2's complement, little endian
*/
[CCode (cname = "ELFDATA2LSB")]
TWO_LSB,
/**
* 2's complement, big endian
*/
[CCode (cname = "ELFDATA2MSB")]
TWO_MSB
}
[CCode (cname = "int", cprefix = "ELF_F_")]
[Flags]
public enum Elf.Flag {
DIRTY,
LAYOUT,
/**
* Allow sections to overlap when {@link LAYOUT} is in effect.
*
* Note that this flag ist NOT portable, and that it may render the output
* file unusable. Use with extreme caution!
*/
LAYOUT_OVERLAP
}
/**
* Identification values for recognized object files.
*/
[CCode (cname = "Elf_Kind")]
public enum Elf.Kind {
/**
* Unknown.
*/
NONE,
/**
* Archive.
*/
AR,
/**
* Stupid old COFF.
*/
COFF,
/**
* ELF file.
*/
ELF,
}
[CCode (cname = "int", cprefix = "EM_")]
public enum Elf.Machine {
/**
* No machine
*/
NONE,
/**
* AT&T WE 32100
*/
M32,
/**
* SUN SPARC
*/
SPARC,
/**
* Intel 80386
*/
[CCode (cname = "EM_386")]
I386,
/**
* Motorola m68k family
*/
[CCode (cname = "EM_68K")]
M68K,
/**
* Motorola m88k family
*/
[CCode (cname = "EM_88K")]
M88K,
/**
* Intel 80860
*/
[CCode (cname = "EM_860")]
M860,
/**
* MIPS R3000 big-endian
*/
MIPS,
/**
* IBM System/370
*/
S370,
/**
* MIPS R3000 little-endian
*/
MIPS_RS3_LE,
/**
* HPPA
*/
PARISC,
/**
* Fujitsu VPP500
*/
VPP500,
/**
* Sun's "v8plus"
*/
SPARC32PLUS,
/**
* Intel 80960
*/
[CCode (cname = "EM_960")]
I960,
/**
* PowerPC
*/
PPC,
/**
* PowerPC 64-bit
*/
PPC64,
/**
* IBM S390
*/
S390,
/**
* NEC V800 series
*/
V800,
/**
* Fujitsu FR20
*/
FR20,
/**
* TRW RH-32
*/
RH32,
/**
* Motorola RCE
*/
RCE,
/**
* ARM
*/
ARM,
/**
* Digital Alpha
*/
FAKE_ALPHA,
ALPHA,
/**
* Hitachi SH
*/
SH,
/**
* SPARC v9 64-bit
*/
SPARCV9,
/**