Skip to content

Commit c55bc99

Browse files
committed
---
yaml --- r: 498 b: refs/heads/master c: 88d9a79 h: refs/heads/master v: v3
1 parent 5cdf941 commit c55bc99

File tree

2 files changed

+51
-26
lines changed

2 files changed

+51
-26
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 22719e45b81fe2985868afa0935cd7b3a5cf6d05
2+
refs/heads/master: 88d9a79ac8b05c5631efeef6a70dec35480ecaab

trunk/src/boot/be/elf.ml

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ let section_header
177177
~(sh_addralign:int64)
178178
~(sh_entsize:int64)
179179
~(sh_link:int64 option)
180+
~(sh_info:int64 option)
180181
: frag =
181182
SEQ
182183
[|
@@ -213,7 +214,9 @@ let section_header
213214
WORD (TY_u32, (IMM (match sh_link with
214215
None -> 0L
215216
| Some i -> i)));
216-
WORD (TY_u32, (IMM 0L)); (* sh_info *)
217+
WORD (TY_u32, (IMM (match sh_info with
218+
None -> 0L
219+
| Some i -> i)));
217220
WORD (TY_u32, (IMM sh_addralign));
218221
WORD (TY_u32, (IMM sh_entsize));
219222
|]
@@ -633,7 +636,7 @@ let elf32_linux_x86_file
633636
let dynsymndx = 4L in (* Section index of .dynsym *)
634637
let dynstrndx = 5L in (* Section index of .dynstr *)
635638
(* let hashndx = 6L in *) (* Section index of .hash *)
636-
(* let pltndx = 7L in *) (* Section index of .plt *)
639+
let pltndx = 7L in (* Section index of .plt *)
637640
(* let gotpltndx = 8L in *) (* Section index of .got.plt *)
638641
(* let relapltndx = 9L in *) (* Section index of .rela.plt *)
639642
let datandx = 10L in (* Section index of .data *)
@@ -695,7 +698,8 @@ let elf32_linux_x86_file
695698
~section_fixup: None
696699
~sh_addralign: 0L
697700
~sh_entsize: 0L
698-
~sh_link: None);
701+
~sh_link: None
702+
~sh_info: None);
699703

700704
(* .interp *)
701705
(section_header
@@ -706,7 +710,8 @@ let elf32_linux_x86_file
706710
~section_fixup: (Some interp_section_fixup)
707711
~sh_addralign: 1L
708712
~sh_entsize: 0L
709-
~sh_link: None);
713+
~sh_link: None
714+
~sh_info: None);
710715

711716
(* .text *)
712717
(section_header
@@ -717,7 +722,8 @@ let elf32_linux_x86_file
717722
~section_fixup: (Some text_section_fixup)
718723
~sh_addralign: 32L
719724
~sh_entsize: 0L
720-
~sh_link: None);
725+
~sh_link: None
726+
~sh_info: None);
721727

722728
(* .rodata *)
723729
(section_header
@@ -728,7 +734,8 @@ let elf32_linux_x86_file
728734
~section_fixup: (Some rodata_section_fixup)
729735
~sh_addralign: 32L
730736
~sh_entsize: 0L
731-
~sh_link: None);
737+
~sh_link: None
738+
~sh_info: None);
732739

733740
(* .dynsym *)
734741
(section_header
@@ -737,9 +744,10 @@ let elf32_linux_x86_file
737744
~sh_type: SHT_DYNSYM
738745
~sh_flags: [ SHF_ALLOC ]
739746
~section_fixup: (Some dynsym_section_fixup)
740-
~sh_addralign: 8L
747+
~sh_addralign: 4L
741748
~sh_entsize: elf32_symsize
742-
~sh_link: (Some dynstrndx) );
749+
~sh_link: (Some dynstrndx)
750+
~sh_info: None );
743751

744752
(* .dynstr *)
745753
(section_header
@@ -750,7 +758,8 @@ let elf32_linux_x86_file
750758
~section_fixup: (Some dynstr_section_fixup)
751759
~sh_addralign: 1L
752760
~sh_entsize: 0L
753-
~sh_link: None);
761+
~sh_link: None
762+
~sh_info: None);
754763

755764
(* .hash *)
756765
(section_header
@@ -761,7 +770,8 @@ let elf32_linux_x86_file
761770
~section_fixup: (Some hash_section_fixup)
762771
~sh_addralign: 4L
763772
~sh_entsize: 4L
764-
~sh_link: (Some dynsymndx));
773+
~sh_link: (Some dynsymndx)
774+
~sh_info: None);
765775

766776
(* .plt *)
767777
(section_header
@@ -772,7 +782,8 @@ let elf32_linux_x86_file
772782
~section_fixup: (Some plt_section_fixup)
773783
~sh_addralign: 4L
774784
~sh_entsize: 0L
775-
~sh_link: None);
785+
~sh_link: None
786+
~sh_info: None);
776787

777788
(* .got.plt *)
778789
(section_header
@@ -783,7 +794,8 @@ let elf32_linux_x86_file
783794
~section_fixup: (Some got_plt_section_fixup)
784795
~sh_addralign: 4L
785796
~sh_entsize: 0L
786-
~sh_link: None);
797+
~sh_link: None
798+
~sh_info: None);
787799

788800
(* .rela.plt *)
789801
(section_header
@@ -794,7 +806,8 @@ let elf32_linux_x86_file
794806
~section_fixup: (Some rela_plt_section_fixup)
795807
~sh_addralign: 4L
796808
~sh_entsize: elf32_rela_entsz
797-
~sh_link: (Some dynsymndx));
809+
~sh_link: (Some dynsymndx)
810+
~sh_info: (Some pltndx));
798811

799812
(* .data *)
800813
(section_header
@@ -805,7 +818,8 @@ let elf32_linux_x86_file
805818
~section_fixup: (Some data_section_fixup)
806819
~sh_addralign: 32L
807820
~sh_entsize: 0L
808-
~sh_link: None);
821+
~sh_link: None
822+
~sh_info: None);
809823

810824
(* .bss *)
811825
(section_header
@@ -816,7 +830,8 @@ let elf32_linux_x86_file
816830
~section_fixup: (Some bss_section_fixup)
817831
~sh_addralign: 32L
818832
~sh_entsize: 0L
819-
~sh_link: None);
833+
~sh_link: None
834+
~sh_info: None);
820835

821836
(* .dynamic *)
822837
(section_header
@@ -827,7 +842,8 @@ let elf32_linux_x86_file
827842
~section_fixup: (Some dynamic_section_fixup)
828843
~sh_addralign: 8L
829844
~sh_entsize: 0L
830-
~sh_link: None);
845+
~sh_link: (Some dynstrndx)
846+
~sh_info: None);
831847

832848
(* .shstrtab *)
833849
(section_header
@@ -838,7 +854,8 @@ let elf32_linux_x86_file
838854
~section_fixup: (Some shstrtab_section_fixup)
839855
~sh_addralign: 1L
840856
~sh_entsize: 0L
841-
~sh_link: None);
857+
~sh_link: None
858+
~sh_info: None);
842859

843860
(*
844861
FIXME: uncomment the dwarf section headers as you make use of them;
@@ -857,7 +874,8 @@ let elf32_linux_x86_file
857874
~section_fixup: (Some sem.Semant.ctxt_debug_aranges_fixup)
858875
~sh_addralign: 8L
859876
~sh_entsize: 0L
860-
~sh_link: None);
877+
~sh_link: None
878+
~sh_info: None);
861879
*)
862880
(* .debug_pubnames *)
863881
(*
@@ -869,7 +887,8 @@ let elf32_linux_x86_file
869887
~section_fixup: (Some sem.Semant.ctxt_debug_pubnames_fixup)
870888
~sh_addralign: 1L
871889
~sh_entsize: 0L
872-
~sh_link: None);
890+
~sh_link: None
891+
~sh_info: None);
873892
*)
874893

875894
(* .debug_info *)
@@ -881,7 +900,8 @@ let elf32_linux_x86_file
881900
~section_fixup: (Some sem.Semant.ctxt_debug_info_fixup)
882901
~sh_addralign: 1L
883902
~sh_entsize: 0L
884-
~sh_link: None);
903+
~sh_link: None
904+
~sh_info: None);
885905

886906
(* .debug_abbrev *)
887907
(section_header
@@ -892,7 +912,9 @@ let elf32_linux_x86_file
892912
~section_fixup: (Some sem.Semant.ctxt_debug_abbrev_fixup)
893913
~sh_addralign: 1L
894914
~sh_entsize: 0L
895-
~sh_link: None);
915+
~sh_link: None
916+
~sh_info: None);
917+
896918
(* .debug_line *)
897919
(*
898920
(section_header
@@ -903,7 +925,8 @@ let elf32_linux_x86_file
903925
~section_fixup: (Some sem.Semant.ctxt_debug_line_fixup)
904926
~sh_addralign: 1L
905927
~sh_entsize: 0L
906-
~sh_link: None);
928+
~sh_link: None
929+
~sh_info: None);
907930
*)
908931

909932
(* .debug_frame *)
@@ -916,7 +939,8 @@ let elf32_linux_x86_file
916939
~section_fixup: (Some sem.Semant.ctxt_debug_frame_fixup)
917940
~sh_addralign: 4L
918941
~sh_entsize: 0L
919-
~sh_link: None);
942+
~sh_link: None
943+
~sh_info: None);
920944
*)
921945

922946
(* .note.rust *)
@@ -928,7 +952,8 @@ let elf32_linux_x86_file
928952
~section_fixup: (Some note_rust_section_fixup)
929953
~sh_addralign: 1L
930954
~sh_entsize: 0L
931-
~sh_link: None);
955+
~sh_link: None
956+
~sh_info: None);
932957

933958
|]
934959
in
@@ -999,7 +1024,7 @@ let elf32_linux_x86_file
9991024
elf32_header
10001025
~sess
10011026
~ei_data: ELFDATA2LSB
1002-
~e_type: ET_DYN
1027+
~e_type: (if sess.Session.sess_library_mode then ET_DYN else ET_EXEC)
10031028
~e_machine: EM_386
10041029
~e_version: EV_CURRENT
10051030

0 commit comments

Comments
 (0)