File tree 1 file changed +20
-6
lines changed 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ type ei_data =
44
44
;;
45
45
46
46
47
- let elf_identification ei_class ei_data =
47
+ let elf_identification sess ei_class ei_data =
48
48
SEQ
49
49
[|
50
50
STRING " \x7f ELF" ;
@@ -58,9 +58,17 @@ let elf_identification ei_class ei_data =
58
58
ELFDATANONE -> 0
59
59
| ELFDATA2LSB -> 1
60
60
| ELFDATA2MSB -> 2 );
61
+
61
62
1 ; (* EI_VERSION = EV_CURRENT *)
62
- 0 ; (* EI_PAD #7 *)
63
- 0 ; (* EI_PAD #8 *)
63
+
64
+ (* EI_OSABI *)
65
+ (match sess.Session. sess_targ with
66
+ FreeBSD_x86_elf -> 9
67
+ | Linux_x86_elf -> 3
68
+ | _ -> 0 );
69
+
70
+ 0 ; (* EI_ABIVERSION *)
71
+
64
72
0 ; (* EI_PAD #9 *)
65
73
0 ; (* EI_PAD #A *)
66
74
0 ; (* EI_PAD #B *)
@@ -117,7 +125,7 @@ let elf32_header
117
125
in
118
126
DEF
119
127
(elf_header_fixup,
120
- SEQ [| elf_identification ELFCLASS32 ei_data;
128
+ SEQ [| elf_identification sess ELFCLASS32 ei_data;
121
129
WORD (TY_u16 , (IMM (match e_type with
122
130
ET_NONE -> 0L
123
131
| ET_REL -> 1L
@@ -1290,7 +1298,11 @@ let elf32_linux_x86_file
1290
1298
in
1291
1299
1292
1300
let interp_section =
1293
- DEF (interp_section_fixup, ZSTRING " /lib/ld-linux.so.2" )
1301
+
1302
+ DEF (interp_section_fixup, ZSTRING
1303
+ (if sess.Session. sess_targ = FreeBSD_x86_elf
1304
+ then " /libexec/ld-elf.so.1"
1305
+ else " /lib/ld-linux.so.2" ))
1294
1306
in
1295
1307
1296
1308
let text_section =
@@ -1584,7 +1596,9 @@ let emit_file
1584
1596
1585
1597
let needed_libs =
1586
1598
[|
1587
- " libc.so.6" ;
1599
+ if sess.Session. sess_targ = FreeBSD_x86_elf
1600
+ then " libc.so.7"
1601
+ else " libc.so.6" ;
1588
1602
" librustrt.so"
1589
1603
|]
1590
1604
in
You can’t perform that action at this time.
0 commit comments