diff options
author | Khem Raj <raj.khem@gmail.com> | 2020-10-29 22:47:03 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-10-31 08:54:12 +0000 |
commit | 4bbb748e08778d9b11d21ade233ce9cdfb56ee44 (patch) | |
tree | 7d6390d74b0b45f08bea0913c416940a7c266c50 | |
parent | b375af7af8915d172c029a80dd2c2dd9a118141b (diff) | |
download | poky-4bbb748e08778d9b11d21ade233ce9cdfb56ee44.tar.gz |
musl: Add .file directive in crt assembly files
This helps linker to noot emit absolute paths into .debug_line sections
of liked binaries and libraries and therefore make them reproducible
Reported-by: Andrei Gherzan <andrei@gherzan.ro>
(From OE-Core rev: cc4b464e31fec68b32592cc84344a9704eae8e02)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/musl/musl/0001-crt-Add-.file-directive.patch | 300 | ||||
-rw-r--r-- | meta/recipes-core/musl/musl_git.bb | 1 |
2 files changed, 301 insertions, 0 deletions
diff --git a/meta/recipes-core/musl/musl/0001-crt-Add-.file-directive.patch b/meta/recipes-core/musl/musl/0001-crt-Add-.file-directive.patch new file mode 100644 index 0000000000..d2bd587e39 --- /dev/null +++ b/meta/recipes-core/musl/musl/0001-crt-Add-.file-directive.patch | |||
@@ -0,0 +1,300 @@ | |||
1 | From b0124f3c4f2a353506621d387135ebea6b8c6609 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 29 Oct 2020 22:40:53 -0700 | ||
4 | Subject: [PATCH] crt: Add .file directive | ||
5 | |||
6 | Musl linked binaries come out to be not reproducible because | ||
7 | absolute build path is seen in debug info of crti.o and crtn.o | ||
8 | This is due to the fact that these objects are built from assembly | ||
9 | source files and they are missing .file directive | ||
10 | if we add .file <filename>.s in them then debug info encodes this | ||
11 | value instead of absolute path in debug_line section | ||
12 | |||
13 | Upstream-Status: Pending | ||
14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
15 | --- | ||
16 | crt/aarch64/crti.s | 1 + | ||
17 | crt/aarch64/crtn.s | 1 + | ||
18 | crt/arm/crti.s | 1 + | ||
19 | crt/arm/crtn.s | 1 + | ||
20 | crt/i386/crti.s | 1 + | ||
21 | crt/i386/crtn.s | 1 + | ||
22 | crt/microblaze/crti.s | 1 + | ||
23 | crt/microblaze/crtn.s | 1 + | ||
24 | crt/mips/crti.s | 1 + | ||
25 | crt/mips/crtn.s | 1 + | ||
26 | crt/mips64/crti.s | 1 + | ||
27 | crt/mips64/crtn.s | 1 + | ||
28 | crt/mipsn32/crti.s | 1 + | ||
29 | crt/mipsn32/crtn.s | 1 + | ||
30 | crt/or1k/crti.s | 1 + | ||
31 | crt/or1k/crtn.s | 1 + | ||
32 | crt/powerpc/crti.s | 1 + | ||
33 | crt/powerpc/crtn.s | 1 + | ||
34 | crt/powerpc64/crti.s | 1 + | ||
35 | crt/powerpc64/crtn.s | 1 + | ||
36 | crt/s390x/crti.s | 1 + | ||
37 | crt/s390x/crtn.s | 1 + | ||
38 | crt/sh/crti.s | 1 + | ||
39 | crt/sh/crtn.s | 1 + | ||
40 | crt/x32/crti.s | 1 + | ||
41 | crt/x32/crtn.s | 1 + | ||
42 | crt/x86_64/crti.s | 1 + | ||
43 | crt/x86_64/crtn.s | 1 + | ||
44 | 28 files changed, 28 insertions(+) | ||
45 | |||
46 | diff --git a/crt/aarch64/crti.s b/crt/aarch64/crti.s | ||
47 | index 775df0ac..0f7c23a9 100644 | ||
48 | --- a/crt/aarch64/crti.s | ||
49 | +++ b/crt/aarch64/crti.s | ||
50 | @@ -1,3 +1,4 @@ | ||
51 | +.file "crti.s" | ||
52 | .section .init | ||
53 | .global _init | ||
54 | .type _init,%function | ||
55 | diff --git a/crt/aarch64/crtn.s b/crt/aarch64/crtn.s | ||
56 | index 73cab692..d62fc129 100644 | ||
57 | --- a/crt/aarch64/crtn.s | ||
58 | +++ b/crt/aarch64/crtn.s | ||
59 | @@ -1,3 +1,4 @@ | ||
60 | +.file "crtn.s" | ||
61 | .section .init | ||
62 | ldp x29,x30,[sp],#16 | ||
63 | ret | ||
64 | diff --git a/crt/arm/crti.s b/crt/arm/crti.s | ||
65 | index 18dc1e41..8df72979 100644 | ||
66 | --- a/crt/arm/crti.s | ||
67 | +++ b/crt/arm/crti.s | ||
68 | @@ -1,3 +1,4 @@ | ||
69 | +.file "crti.s" | ||
70 | .syntax unified | ||
71 | |||
72 | .section .init | ||
73 | diff --git a/crt/arm/crtn.s b/crt/arm/crtn.s | ||
74 | index dc020f92..7451355b 100644 | ||
75 | --- a/crt/arm/crtn.s | ||
76 | +++ b/crt/arm/crtn.s | ||
77 | @@ -1,3 +1,4 @@ | ||
78 | +.file "crtn.s" | ||
79 | .syntax unified | ||
80 | |||
81 | .section .init | ||
82 | diff --git a/crt/i386/crti.s b/crt/i386/crti.s | ||
83 | index d2682a20..2823fc3b 100644 | ||
84 | --- a/crt/i386/crti.s | ||
85 | +++ b/crt/i386/crti.s | ||
86 | @@ -1,3 +1,4 @@ | ||
87 | +.file "crti.s" | ||
88 | .section .init | ||
89 | .global _init | ||
90 | _init: | ||
91 | diff --git a/crt/i386/crtn.s b/crt/i386/crtn.s | ||
92 | index f3b61e01..04fb1646 100644 | ||
93 | --- a/crt/i386/crtn.s | ||
94 | +++ b/crt/i386/crtn.s | ||
95 | @@ -1,3 +1,4 @@ | ||
96 | +.file "crtn.s" | ||
97 | .section .init | ||
98 | add $12,%esp | ||
99 | ret | ||
100 | diff --git a/crt/microblaze/crti.s b/crt/microblaze/crti.s | ||
101 | index ed1c2fa4..29ee4733 100644 | ||
102 | --- a/crt/microblaze/crti.s | ||
103 | +++ b/crt/microblaze/crti.s | ||
104 | @@ -1,3 +1,4 @@ | ||
105 | +.file "crti.s" | ||
106 | .section .init | ||
107 | .global _init | ||
108 | .align 2 | ||
109 | diff --git a/crt/microblaze/crtn.s b/crt/microblaze/crtn.s | ||
110 | index 1e02c984..c2083749 100644 | ||
111 | --- a/crt/microblaze/crtn.s | ||
112 | +++ b/crt/microblaze/crtn.s | ||
113 | @@ -1,3 +1,4 @@ | ||
114 | +.file "crtn.s" | ||
115 | .section .init | ||
116 | lwi r15, r1, 0 | ||
117 | rtsd r15, 8 | ||
118 | diff --git a/crt/mips/crti.s b/crt/mips/crti.s | ||
119 | index 39dee380..0211764e 100644 | ||
120 | --- a/crt/mips/crti.s | ||
121 | +++ b/crt/mips/crti.s | ||
122 | @@ -1,3 +1,4 @@ | ||
123 | +.file "crti.s" | ||
124 | .set noreorder | ||
125 | |||
126 | .section .init | ||
127 | diff --git a/crt/mips/crtn.s b/crt/mips/crtn.s | ||
128 | index 506a04b7..606490cf 100644 | ||
129 | --- a/crt/mips/crtn.s | ||
130 | +++ b/crt/mips/crtn.s | ||
131 | @@ -1,3 +1,4 @@ | ||
132 | +.file "crtn.s" | ||
133 | .set noreorder | ||
134 | |||
135 | .section .init | ||
136 | diff --git a/crt/mips64/crti.s b/crt/mips64/crti.s | ||
137 | index c962dd09..f2c19cdd 100644 | ||
138 | --- a/crt/mips64/crti.s | ||
139 | +++ b/crt/mips64/crti.s | ||
140 | @@ -1,3 +1,4 @@ | ||
141 | +.file "crti.s" | ||
142 | .set noreorder | ||
143 | |||
144 | .section .init | ||
145 | diff --git a/crt/mips64/crtn.s b/crt/mips64/crtn.s | ||
146 | index f3930b24..68903ffa 100644 | ||
147 | --- a/crt/mips64/crtn.s | ||
148 | +++ b/crt/mips64/crtn.s | ||
149 | @@ -1,3 +1,4 @@ | ||
150 | +.file "crtn.s" | ||
151 | .set noreorder | ||
152 | |||
153 | .section .init | ||
154 | diff --git a/crt/mipsn32/crti.s b/crt/mipsn32/crti.s | ||
155 | index 14fa28d9..a35387d3 100644 | ||
156 | --- a/crt/mipsn32/crti.s | ||
157 | +++ b/crt/mipsn32/crti.s | ||
158 | @@ -1,3 +1,4 @@ | ||
159 | +.file "crti.s" | ||
160 | .set noreorder | ||
161 | .section .init | ||
162 | .global _init | ||
163 | diff --git a/crt/mipsn32/crtn.s b/crt/mipsn32/crtn.s | ||
164 | index dccd7e89..bdb6e561 100644 | ||
165 | --- a/crt/mipsn32/crtn.s | ||
166 | +++ b/crt/mipsn32/crtn.s | ||
167 | @@ -1,3 +1,4 @@ | ||
168 | +.file "crtn.s" | ||
169 | .set noreorder | ||
170 | .section .init | ||
171 | ld $gp, 16($sp) | ||
172 | diff --git a/crt/or1k/crti.s b/crt/or1k/crti.s | ||
173 | index 7e741459..919369ca 100644 | ||
174 | --- a/crt/or1k/crti.s | ||
175 | +++ b/crt/or1k/crti.s | ||
176 | @@ -1,3 +1,4 @@ | ||
177 | +.file "crti.s" | ||
178 | .section .init | ||
179 | .global _init | ||
180 | _init: | ||
181 | diff --git a/crt/or1k/crtn.s b/crt/or1k/crtn.s | ||
182 | index 4185a027..d670b327 100644 | ||
183 | --- a/crt/or1k/crtn.s | ||
184 | +++ b/crt/or1k/crtn.s | ||
185 | @@ -1,3 +1,4 @@ | ||
186 | +.file "crtn.s" | ||
187 | .section .init | ||
188 | l.lwz r9,0(r1) | ||
189 | l.jr r9 | ||
190 | diff --git a/crt/powerpc/crti.s b/crt/powerpc/crti.s | ||
191 | index 60461ca4..b748ca48 100644 | ||
192 | --- a/crt/powerpc/crti.s | ||
193 | +++ b/crt/powerpc/crti.s | ||
194 | @@ -1,3 +1,4 @@ | ||
195 | +.file "crti.s" | ||
196 | .section .init | ||
197 | .align 2 | ||
198 | .global _init | ||
199 | diff --git a/crt/powerpc/crtn.s b/crt/powerpc/crtn.s | ||
200 | index 2d14a6f0..d989e36f 100644 | ||
201 | --- a/crt/powerpc/crtn.s | ||
202 | +++ b/crt/powerpc/crtn.s | ||
203 | @@ -1,3 +1,4 @@ | ||
204 | +.file "crtn.s" | ||
205 | .section .init | ||
206 | .align 2 | ||
207 | lwz 0,36(1) | ||
208 | diff --git a/crt/powerpc64/crti.s b/crt/powerpc64/crti.s | ||
209 | index 9f712f0e..d3323a67 100644 | ||
210 | --- a/crt/powerpc64/crti.s | ||
211 | +++ b/crt/powerpc64/crti.s | ||
212 | @@ -1,3 +1,4 @@ | ||
213 | +.file "crti.s" | ||
214 | .section .init | ||
215 | .align 2 | ||
216 | .global _init | ||
217 | diff --git a/crt/powerpc64/crtn.s b/crt/powerpc64/crtn.s | ||
218 | index a7a9f4a0..5e71ae66 100644 | ||
219 | --- a/crt/powerpc64/crtn.s | ||
220 | +++ b/crt/powerpc64/crtn.s | ||
221 | @@ -1,3 +1,4 @@ | ||
222 | +.file "crtn.s" | ||
223 | .section .init | ||
224 | .align 2 | ||
225 | addi 1, 1, 32 | ||
226 | diff --git a/crt/s390x/crti.s b/crt/s390x/crti.s | ||
227 | index f453205b..3da3c5e1 100644 | ||
228 | --- a/crt/s390x/crti.s | ||
229 | +++ b/crt/s390x/crti.s | ||
230 | @@ -1,3 +1,4 @@ | ||
231 | +.file "crti.s" | ||
232 | .section .init | ||
233 | .align 2 | ||
234 | .global _init | ||
235 | diff --git a/crt/s390x/crtn.s b/crt/s390x/crtn.s | ||
236 | index 06066dc9..bfd55caf 100644 | ||
237 | --- a/crt/s390x/crtn.s | ||
238 | +++ b/crt/s390x/crtn.s | ||
239 | @@ -1,3 +1,4 @@ | ||
240 | +.file "crtn.s" | ||
241 | .section .init | ||
242 | .align 2 | ||
243 | lmg %r14, %r15, 272(%r15) | ||
244 | diff --git a/crt/sh/crti.s b/crt/sh/crti.s | ||
245 | index d99bfd5c..77d61c51 100644 | ||
246 | --- a/crt/sh/crti.s | ||
247 | +++ b/crt/sh/crti.s | ||
248 | @@ -1,3 +1,4 @@ | ||
249 | +.file "crti.s" | ||
250 | .section .init | ||
251 | .global _init | ||
252 | .type _init, @function | ||
253 | diff --git a/crt/sh/crtn.s b/crt/sh/crtn.s | ||
254 | index 958ce951..29deb5be 100644 | ||
255 | --- a/crt/sh/crtn.s | ||
256 | +++ b/crt/sh/crtn.s | ||
257 | @@ -1,3 +1,4 @@ | ||
258 | +.file "crtn.s" | ||
259 | .section .init | ||
260 | lds.l @r15+, pr | ||
261 | mov.l @r15+, r14 | ||
262 | diff --git a/crt/x32/crti.s b/crt/x32/crti.s | ||
263 | index 4788968b..8668b7c7 100644 | ||
264 | --- a/crt/x32/crti.s | ||
265 | +++ b/crt/x32/crti.s | ||
266 | @@ -1,3 +1,4 @@ | ||
267 | +.file "crti.s" | ||
268 | .section .init | ||
269 | .global _init | ||
270 | _init: | ||
271 | diff --git a/crt/x32/crtn.s b/crt/x32/crtn.s | ||
272 | index 29198b77..ef73d295 100644 | ||
273 | --- a/crt/x32/crtn.s | ||
274 | +++ b/crt/x32/crtn.s | ||
275 | @@ -1,3 +1,4 @@ | ||
276 | +.file "crtn.s" | ||
277 | .section .init | ||
278 | pop %rax | ||
279 | ret | ||
280 | diff --git a/crt/x86_64/crti.s b/crt/x86_64/crti.s | ||
281 | index 4788968b..8668b7c7 100644 | ||
282 | --- a/crt/x86_64/crti.s | ||
283 | +++ b/crt/x86_64/crti.s | ||
284 | @@ -1,3 +1,4 @@ | ||
285 | +.file "crti.s" | ||
286 | .section .init | ||
287 | .global _init | ||
288 | _init: | ||
289 | diff --git a/crt/x86_64/crtn.s b/crt/x86_64/crtn.s | ||
290 | index 29198b77..ef73d295 100644 | ||
291 | --- a/crt/x86_64/crtn.s | ||
292 | +++ b/crt/x86_64/crtn.s | ||
293 | @@ -1,3 +1,4 @@ | ||
294 | +.file "crtn.s" | ||
295 | .section .init | ||
296 | pop %rax | ||
297 | ret | ||
298 | -- | ||
299 | 2.29.1 | ||
300 | |||
diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb index 897e56e10f..504fdfe019 100644 --- a/meta/recipes-core/musl/musl_git.bb +++ b/meta/recipes-core/musl/musl_git.bb | |||
@@ -15,6 +15,7 @@ PV = "${BASEVER}+git${SRCPV}" | |||
15 | SRC_URI = "git://git.musl-libc.org/musl \ | 15 | SRC_URI = "git://git.musl-libc.org/musl \ |
16 | file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \ | 16 | file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \ |
17 | file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \ | 17 | file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \ |
18 | file://0001-crt-Add-.file-directive.patch \ | ||
18 | " | 19 | " |
19 | 20 | ||
20 | S = "${WORKDIR}/git" | 21 | S = "${WORKDIR}/git" |