aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rust/alpine-target.patch
blob: e013a6bc2ec85b649ba188be9ddec8843461d47a (plain)
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
From: Shiz <hi@shiz.me>
Date: Thu, 20 Aug 2017 01:52:36 +0200
Subject: [PATCH] Add Alpine targets

This adds `$arch-alpine-linux-musl` targets to Rust to encode our toolchain
and distribution-specific quirks instead of polluting the main musl target of
`$arch-unknown-linux-musl`.

--- /dev/null
+++ b/src/librustc_back/target/i586_alpine_linux_musl.rs
@@ -0,0 +1,32 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use target::{Target, TargetResult};
+
+pub fn target() -> TargetResult {
+    let mut base = super::linux_musl_base::opts();
+    base.cpu = "pentium4".to_string();
+    base.max_atomic_width = Some(64);
+    base.crt_static_default = false;
+    base.static_position_independent_executables = true;
+    base.need_rpath = true;
+
+    Ok(Target {
+        llvm_target: "i586-alpine-linux-musl".to_string(),
+        target_endian: "little".to_string(),
+        target_pointer_width: "32".to_string(),
+        data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
+        arch: "x86".to_string(),
+        target_os: "linux".to_string(),
+        target_env: "musl".to_string(),
+        target_vendor: "alpine".to_string(),
+        options: base,
+    })
+}
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -214,6 +214,9 @@
     ("thumbv7m-none-eabi", thumbv7m_none_eabi),
     ("thumbv7em-none-eabi", thumbv7em_none_eabi),
     ("thumbv7em-none-eabihf", thumbv7em_none_eabihf),
+
+    ("i586-alpine-linux-musl", i586_alpine_linux_musl),
+    ("x86_64-alpine-linux-musl", x86_64_alpine_linux_musl),
 }
 
 /// Everything `rustc` knows about how to compile for a specific target.
--- /dev/null
+++ b/src/librustc_back/target/x86_64_alpine_linux_musl.rs
@@ -0,0 +1,32 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use target::{Target, TargetResult};
+
+pub fn target() -> TargetResult {
+    let mut base = super::linux_musl_base::opts();
+    base.cpu = "x86-64".to_string();
+    base.max_atomic_width = Some(64);
+    base.crt_static_default = false;
+    base.static_position_independent_executables = true;
+    base.need_rpath = true;
+
+    Ok(Target {
+        llvm_target: "x86_64-alpine-linux-musl".to_string(),
+        target_endian: "little".to_string(),
+        target_pointer_width: "64".to_string(),
+        data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
+        arch: "x86_64".to_string(),
+        target_os: "linux".to_string(),
+        target_env: "musl".to_string(),
+        target_vendor: "alpine".to_string(),
+        options: base,
+    })
+}
--- /dev/null
+++ b/mk/cfg/i586-alpine-linux-musl.mk
@@ -0,0 +1,29 @@
+# i586-alpine-linux-musl configuration
+CC_i586-alpine-linux-musl=$(CC)
+CXX_i586-alpine-linux-musl=$(CXX)
+CPP_i586-alpine-linux-musl=$(CPP)
+AR_i586-alpine-linux-musl=$(AR)
+CFG_INSTALL_ONLY_RLIB_i586-alpine-linux-musl = 0
+CFG_LIB_NAME_i586-alpine-linux-musl=lib$(1).so
+CFG_STATIC_LIB_NAME_i586-alpine-linux-musl=lib$(1).a
+CFG_LIB_GLOB_i586-alpine-linux-musl=lib$(1)-*.so
+CFG_JEMALLOC_CFLAGS_i586-alpine-linux-musl := 
+CFG_GCCISH_CFLAGS_i586-alpine-linux-musl :=  -g -fPIC
+CFG_GCCISH_CXXFLAGS_i586-alpine-linux-musl :=
+CFG_GCCISH_LINK_FLAGS_i586-alpine-linux-musl :=
+CFG_GCCISH_DEF_FLAG_i586-alpine-linux-musl :=
+CFG_LLC_FLAGS_i586-alpine-linux-musl :=
+CFG_INSTALL_NAME_i586-alpine-linux-musl =
+CFG_EXE_SUFFIX_i586-alpine-linux-musl =
+CFG_WINDOWSY_i586-alpine-linux-musl :=
+CFG_UNIXY_i586-alpine-linux-musl := 1
+CFG_LDPATH_i586-alpine-linux-musl :=
+CFG_RUN_i586-alpine-linux-musl=$(2)
+CFG_RUN_TARG_i586-alpine-linux-musl=$(call CFG_RUN_i586-alpine-linux-musl,,$(2))
+CFG_GNU_TRIPLE_i586-alpine-linux-musl := i586-alpine-linux-musl
+CFG_THIRD_PARTY_OBJECTS_i586-alpine-linux-musl := 
+CFG_INSTALLED_OBJECTS_i586-alpine-linux-musl := 
+
+NATIVE_DEPS_libc_T_i586-alpine-linux-musl += libc.a
+NATIVE_DEPS_std_T_i586-alpine-linux-musl += 
+NATIVE_DEPS_unwind_T_i586-alpine-linux-musl += libunwind.a
--- /dev/null
+++ b/mk/cfg/x86_64-alpine-linux-musl.mk
@@ -0,0 +1,29 @@
+# x86_64-alpine-linux-musl configuration
+CC_x86_64-alpine-linux-musl=$(CC)
+CXX_x86_64-alpine-linux-musl=$(CXX)
+CPP_x86_64-alpine-linux-musl=$(CPP)
+AR_x86_64-alpine-linux-musl=$(AR)
+CFG_INSTALL_ONLY_RLIB_x86_64-alpine-linux-musl = 0
+CFG_LIB_NAME_x86_64-alpine-linux-musl=lib$(1).so
+CFG_STATIC_LIB_NAME_x86_64-alpine-linux-musl=lib$(1).a
+CFG_LIB_GLOB_x86_64-alpine-linux-musl=lib$(1)-*.so
+CFG_JEMALLOC_CFLAGS_x86_64-alpine-linux-musl :=
+CFG_GCCISH_CFLAGS_x86_64-alpine-linux-musl :=  -g -fPIC
+CFG_GCCISH_CXXFLAGS_x86_64-alpine-linux-musl :=
+CFG_GCCISH_LINK_FLAGS_x86_64-alpine-linux-musl :=
+CFG_GCCISH_DEF_FLAG_x86_64-alpine-linux-musl :=
+CFG_LLC_FLAGS_x86_64-alpine-linux-musl :=
+CFG_INSTALL_NAME_x86_64-alpine-linux-musl =
+CFG_EXE_SUFFIX_x86_64-alpine-linux-musl =
+CFG_WINDOWSY_x86_64-alpine-linux-musl :=
+CFG_UNIXY_x86_64-alpine-linux-musl := 1
+CFG_LDPATH_x86_64-alpine-linux-musl :=
+CFG_RUN_x86_64-alpine-linux-musl=$(2)
+CFG_RUN_TARG_x86_64-alpine-linux-musl=$(call CFG_RUN_x86_64-alpine-linux-musl,,$(2))
+CFG_GNU_TRIPLE_x86_64-alpine-linux-musl := x86_64-alpine-linux-musl
+CFG_THIRD_PARTY_OBJECTS_x86_64-alpine-linux-musl := 
+CFG_INSTALLED_OBJECTS_x86_64-alpine-linux-musl := 
+
+NATIVE_DEPS_libc_T_x86_64-alpine-linux-musl += libc.a
+NATIVE_DEPS_std_T_x86_64-alpine-linux-musl += 
+NATIVE_DEPS_unwind_T_x86_64-alpine-linux-musl += libunwind.a