diff options
Diffstat (limited to 'meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch')
-rw-r--r-- | meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch | 129 |
1 files changed, 50 insertions, 79 deletions
diff --git a/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch b/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch index bbfae2e8a5..f788e0fd43 100644 --- a/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch +++ b/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch | |||
@@ -1,7 +1,7 @@ | |||
1 | From fa677c1caf6b8192971920cf5c1aa8cb33c74605 Mon Sep 17 00:00:00 2001 | 1 | From bb4e42ad3a0cdd23a1d1797e6299c76b474867c0 Mon Sep 17 00:00:00 2001 |
2 | From: Joshua Watt <JPEWhacker@gmail.com> | 2 | From: Joshua Watt <JPEWhacker@gmail.com> |
3 | Date: Tue, 19 Nov 2019 13:12:17 -0600 | 3 | Date: Tue, 19 Nov 2019 13:12:17 -0600 |
4 | Subject: [PATCH 2/2] Add --debug-prefix-map option | 4 | Subject: [PATCH] Add --debug-prefix-map option |
5 | 5 | ||
6 | Adds an option to remap file prefixes in output object files. This is | 6 | Adds an option to remap file prefixes in output object files. This is |
7 | analogous to the "-fdebug-prefix-map" option in GCC, and allows files to | 7 | analogous to the "-fdebug-prefix-map" option in GCC, and allows files to |
@@ -9,47 +9,48 @@ be built in a reproducible manner regardless of the build directory. | |||
9 | 9 | ||
10 | Upstream-Status: Submitted [https://bugzilla.nasm.us/show_bug.cgi?id=3392635] | 10 | Upstream-Status: Submitted [https://bugzilla.nasm.us/show_bug.cgi?id=3392635] |
11 | Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> | 11 | Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> |
12 | |||
12 | --- | 13 | --- |
13 | asm/nasm.c | 28 ++++++++++++++++++++++++++-- | 14 | asm/nasm.c | 26 +++++++++++++++++++++++++- |
14 | include/nasmlib.h | 9 +++++++++ | 15 | include/nasmlib.h | 9 +++++++++ |
15 | nasm.txt | 4 ++++ | 16 | nasm.txt | 4 ++++ |
16 | nasmlib/filename.c | 20 ++++++++++++++++++++ | 17 | nasmlib/filename.c | 20 ++++++++++++++++++++ |
17 | output/outas86.c | 4 +++- | 18 | output/outas86.c | 4 +++- |
18 | output/outcoff.c | 4 ++-- | 19 | output/outcoff.c | 4 ++-- |
19 | output/outelf.c | 8 ++++---- | 20 | output/outelf.c | 2 +- |
20 | output/outieee.c | 2 +- | 21 | output/outieee.c | 2 +- |
21 | output/outobj.c | 2 +- | 22 | output/outobj.c | 2 +- |
22 | stdlib/strlcat.c | 2 +- | 23 | stdlib/strlcat.c | 2 +- |
23 | test/elfdebugprefix.asm | 6 ++++++ | 24 | test/elfdebugprefix.asm | 6 ++++++ |
24 | test/performtest.pl | 12 ++++++++++-- | 25 | test/performtest.pl | 12 ++++++++++-- |
25 | 12 files changed, 87 insertions(+), 14 deletions(-) | 26 | 12 files changed, 83 insertions(+), 10 deletions(-) |
26 | create mode 100644 test/elfdebugprefix.asm | 27 | create mode 100644 test/elfdebugprefix.asm |
27 | 28 | ||
28 | diff --git a/asm/nasm.c b/asm/nasm.c | 29 | diff --git a/asm/nasm.c b/asm/nasm.c |
29 | index 1c5a5fc5..5d45103c 100644 | 30 | index a0e1719..fc6c62e 100644 |
30 | --- a/asm/nasm.c | 31 | --- a/asm/nasm.c |
31 | +++ b/asm/nasm.c | 32 | +++ b/asm/nasm.c |
32 | @@ -841,7 +841,8 @@ enum text_options { | 33 | @@ -938,7 +938,8 @@ enum text_options { |
33 | OPT_BEFORE, | ||
34 | OPT_LIMIT, | 34 | OPT_LIMIT, |
35 | OPT_KEEP_ALL, | 35 | OPT_KEEP_ALL, |
36 | - OPT_NO_LINE | 36 | OPT_NO_LINE, |
37 | + OPT_NO_LINE, | 37 | - OPT_DEBUG |
38 | + OPT_DEBUG, | ||
38 | + OPT_DEBUG_PREFIX_MAP | 39 | + OPT_DEBUG_PREFIX_MAP |
39 | }; | 40 | }; |
40 | struct textargs { | 41 | enum need_arg { |
41 | const char *label; | 42 | ARG_NO, |
42 | @@ -866,6 +867,7 @@ static const struct textargs textopts[] = { | 43 | @@ -970,6 +971,7 @@ static const struct textargs textopts[] = { |
43 | {"limit-", OPT_LIMIT, true, 0}, | 44 | {"keep-all", OPT_KEEP_ALL, ARG_NO, 0}, |
44 | {"keep-all", OPT_KEEP_ALL, false, 0}, | 45 | {"no-line", OPT_NO_LINE, ARG_NO, 0}, |
45 | {"no-line", OPT_NO_LINE, false, 0}, | 46 | {"debug", OPT_DEBUG, ARG_MAYBE, 0}, |
46 | + {"debug-prefix-map", OPT_DEBUG_PREFIX_MAP, true, 0}, | 47 | + {"debug-prefix-map", OPT_DEBUG_PREFIX_MAP, true, 0}, |
47 | {NULL, OPT_BOGUS, false, 0} | 48 | {NULL, OPT_BOGUS, ARG_NO, 0} |
48 | }; | 49 | }; |
49 | 50 | ||
50 | @@ -1217,6 +1219,26 @@ static bool process_arg(char *p, char *q, int pass) | 51 | @@ -1332,6 +1334,26 @@ static bool process_arg(char *p, char *q, int pass) |
51 | case OPT_NO_LINE: | 52 | case OPT_DEBUG: |
52 | pp_noline = true; | 53 | debug_nasm = param ? strtoul(param, NULL, 10) : debug_nasm+1; |
53 | break; | 54 | break; |
54 | + case OPT_DEBUG_PREFIX_MAP: { | 55 | + case OPT_DEBUG_PREFIX_MAP: { |
55 | + struct debug_prefix_list *d; | 56 | + struct debug_prefix_list *d; |
@@ -72,24 +73,22 @@ index 1c5a5fc5..5d45103c 100644 | |||
72 | + } | 73 | + } |
73 | + break; | 74 | + break; |
74 | case OPT_HELP: | 75 | case OPT_HELP: |
75 | help(0); | 76 | help(stdout); |
76 | exit(0); | 77 | exit(0); |
77 | @@ -2010,7 +2032,9 @@ static void help(const char xopt) | 78 | @@ -2297,6 +2319,8 @@ static void help(FILE *out) |
78 | " --lpostfix str append the given string to all other symbols\n" | 79 | " -w-x disable warning x (also -Wno-x)\n" |
79 | " --keep-all output files will not be removed even if an error happens\n" | 80 | " -w[+-]error promote all warnings to errors (also -Werror)\n" |
80 | " --no-line ignore %%line directives in input\n" | 81 | " -w[+-]error=x promote warning x to errors (also -Werror=x)\n" |
81 | - " --limit-X val set execution limit X\n"); | 82 | + " --debug-prefix-map base=dest\n" |
82 | + " --limit-X val set execution limit X\n" | 83 | + " remap paths starting with 'base' to 'dest' in output files\n" |
83 | + " --debug-prefix-map base=dest\n" | 84 | , out); |
84 | + " remap paths starting with 'base' to 'dest' in output files\n"); | ||
85 | 85 | ||
86 | for (i = 0; i <= LIMIT_MAX; i++) { | 86 | fprintf(out, " %-20s %s\n", |
87 | printf(" %-15s %s (default ", | ||
88 | diff --git a/include/nasmlib.h b/include/nasmlib.h | 87 | diff --git a/include/nasmlib.h b/include/nasmlib.h |
89 | index e57d0e6d..cf921547 100644 | 88 | index e9bfbcc..98fc653 100644 |
90 | --- a/include/nasmlib.h | 89 | --- a/include/nasmlib.h |
91 | +++ b/include/nasmlib.h | 90 | +++ b/include/nasmlib.h |
92 | @@ -195,10 +195,19 @@ int64_t readstrnum(char *str, int length, bool *warn); | 91 | @@ -250,10 +250,19 @@ int64_t readstrnum(char *str, int length, bool *warn); |
93 | */ | 92 | */ |
94 | int32_t seg_alloc(void); | 93 | int32_t seg_alloc(void); |
95 | 94 | ||
@@ -110,7 +109,7 @@ index e57d0e6d..cf921547 100644 | |||
110 | /* | 109 | /* |
111 | * Utility macros... | 110 | * Utility macros... |
112 | diff --git a/nasm.txt b/nasm.txt | 111 | diff --git a/nasm.txt b/nasm.txt |
113 | index a28202f9..443c06b2 100644 | 112 | index cc7fa27..d3485c9 100644 |
114 | --- a/nasm.txt | 113 | --- a/nasm.txt |
115 | +++ b/nasm.txt | 114 | +++ b/nasm.txt |
116 | @@ -147,6 +147,10 @@ OPTIONS | 115 | @@ -147,6 +147,10 @@ OPTIONS |
@@ -125,7 +124,7 @@ index a28202f9..443c06b2 100644 | |||
125 | ------ | 124 | ------ |
126 | This man page does not fully describe the syntax of *nasm*'s assembly language, | 125 | This man page does not fully describe the syntax of *nasm*'s assembly language, |
127 | diff --git a/nasmlib/filename.c b/nasmlib/filename.c | 126 | diff --git a/nasmlib/filename.c b/nasmlib/filename.c |
128 | index 172ae0bc..fda2be41 100644 | 127 | index 172ae0b..fda2be4 100644 |
129 | --- a/nasmlib/filename.c | 128 | --- a/nasmlib/filename.c |
130 | +++ b/nasmlib/filename.c | 129 | +++ b/nasmlib/filename.c |
131 | @@ -39,6 +39,8 @@ | 130 | @@ -39,6 +39,8 @@ |
@@ -160,10 +159,10 @@ index 172ae0bc..fda2be41 100644 | |||
160 | + return dest; | 159 | + return dest; |
161 | +} | 160 | +} |
162 | diff --git a/output/outas86.c b/output/outas86.c | 161 | diff --git a/output/outas86.c b/output/outas86.c |
163 | index 3f9867b9..d5f4f966 100644 | 162 | index 54b22f8..c4a412c 100644 |
164 | --- a/output/outas86.c | 163 | --- a/output/outas86.c |
165 | +++ b/output/outas86.c | 164 | +++ b/output/outas86.c |
166 | @@ -113,6 +113,8 @@ static void as86_sect_write(struct Section *, const uint8_t *, | 165 | @@ -110,6 +110,8 @@ static void as86_sect_write(struct Section *, const uint8_t *, |
167 | 166 | ||
168 | static void as86_init(void) | 167 | static void as86_init(void) |
169 | { | 168 | { |
@@ -172,7 +171,7 @@ index 3f9867b9..d5f4f966 100644 | |||
172 | stext.data = saa_init(1L); | 171 | stext.data = saa_init(1L); |
173 | stext.datalen = 0L; | 172 | stext.datalen = 0L; |
174 | stext.head = stext.last = NULL; | 173 | stext.head = stext.last = NULL; |
175 | @@ -134,7 +136,7 @@ static void as86_init(void) | 174 | @@ -131,7 +133,7 @@ static void as86_init(void) |
176 | strslen = 0; | 175 | strslen = 0; |
177 | 176 | ||
178 | /* as86 module name = input file minus extension */ | 177 | /* as86 module name = input file minus extension */ |
@@ -182,10 +181,10 @@ index 3f9867b9..d5f4f966 100644 | |||
182 | 181 | ||
183 | static void as86_cleanup(void) | 182 | static void as86_cleanup(void) |
184 | diff --git a/output/outcoff.c b/output/outcoff.c | 183 | diff --git a/output/outcoff.c b/output/outcoff.c |
185 | index a2fd302c..bcf576fb 100644 | 184 | index bcd9ff3..15bfcf3 100644 |
186 | --- a/output/outcoff.c | 185 | --- a/output/outcoff.c |
187 | +++ b/output/outcoff.c | 186 | +++ b/output/outcoff.c |
188 | @@ -1070,14 +1070,14 @@ static void coff_symbol(char *name, int32_t strpos, int32_t value, | 187 | @@ -1095,14 +1095,14 @@ static void coff_symbol(char *name, int32_t strpos, int32_t value, |
189 | 188 | ||
190 | static void coff_write_symbols(void) | 189 | static void coff_write_symbols(void) |
191 | { | 190 | { |
@@ -203,48 +202,23 @@ index a2fd302c..bcf576fb 100644 | |||
203 | 202 | ||
204 | /* | 203 | /* |
205 | diff --git a/output/outelf.c b/output/outelf.c | 204 | diff --git a/output/outelf.c b/output/outelf.c |
206 | index de99d076..203b5dc0 100644 | 205 | index 61af020..1292958 100644 |
207 | --- a/output/outelf.c | 206 | --- a/output/outelf.c |
208 | +++ b/output/outelf.c | 207 | +++ b/output/outelf.c |
209 | @@ -1,5 +1,5 @@ | 208 | @@ -553,7 +553,7 @@ static void elf_init(void) |
210 | /* ----------------------------------------------------------------------- * | 209 | }; |
211 | - * | 210 | const char * const *p; |
212 | + * | ||
213 | * Copyright 1996-2017 The NASM Authors - All Rights Reserved | ||
214 | * See the file AUTHORS included with the NASM distribution for | ||
215 | * the specific copyright holders. | ||
216 | @@ -14,7 +14,7 @@ | ||
217 | * copyright notice, this list of conditions and the following | ||
218 | * disclaimer in the documentation and/or other materials provided | ||
219 | * with the distribution. | ||
220 | - * | ||
221 | + * | ||
222 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
223 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
224 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
225 | @@ -315,7 +315,7 @@ elf_directive(enum directive directive, char *value, int pass) | ||
226 | 211 | ||
227 | static void elf_init(void) | ||
228 | { | ||
229 | - strlcpy(elf_module, inname, sizeof(elf_module)); | 212 | - strlcpy(elf_module, inname, sizeof(elf_module)); |
230 | + filename_debug_remap(elf_module, inname, sizeof(elf_module)); | 213 | + filename_debug_remap(elf_module, inname, sizeof(elf_module)); |
231 | sects = NULL; | 214 | sects = NULL; |
232 | nsects = sectlen = 0; | 215 | nsects = sectlen = 0; |
233 | syms = saa_init((int32_t)sizeof(struct elf_symbol)); | 216 | syms = saa_init((int32_t)sizeof(struct elf_symbol)); |
234 | @@ -868,7 +868,7 @@ static void elf32_out(int32_t segto, const void *data, | ||
235 | " segment base references"); | ||
236 | } else { | ||
237 | if (wrt == NO_SEG) { | ||
238 | - /* | ||
239 | + /* | ||
240 | * The if() is a hack to deal with compilers which | ||
241 | * don't handle switch() statements with 64-bit | ||
242 | * expressions. | ||
243 | diff --git a/output/outieee.c b/output/outieee.c | 217 | diff --git a/output/outieee.c b/output/outieee.c |
244 | index 3a28942d..f61824e4 100644 | 218 | index 4cc0f0f..2468724 100644 |
245 | --- a/output/outieee.c | 219 | --- a/output/outieee.c |
246 | +++ b/output/outieee.c | 220 | +++ b/output/outieee.c |
247 | @@ -209,7 +209,7 @@ static void ieee_unqualified_name(char *, char *); | 221 | @@ -207,7 +207,7 @@ static void ieee_unqualified_name(char *, char *); |
248 | */ | 222 | */ |
249 | static void ieee_init(void) | 223 | static void ieee_init(void) |
250 | { | 224 | { |
@@ -254,10 +228,10 @@ index 3a28942d..f61824e4 100644 | |||
254 | fpubhead = NULL; | 228 | fpubhead = NULL; |
255 | fpubtail = &fpubhead; | 229 | fpubtail = &fpubhead; |
256 | diff --git a/output/outobj.c b/output/outobj.c | 230 | diff --git a/output/outobj.c b/output/outobj.c |
257 | index b4f2c499..55bba4a1 100644 | 231 | index 0d4d311..d8dd6a0 100644 |
258 | --- a/output/outobj.c | 232 | --- a/output/outobj.c |
259 | +++ b/output/outobj.c | 233 | +++ b/output/outobj.c |
260 | @@ -640,7 +640,7 @@ static enum directive_result obj_directive(enum directive, char *, int); | 234 | @@ -638,7 +638,7 @@ static enum directive_result obj_directive(enum directive, char *); |
261 | 235 | ||
262 | static void obj_init(void) | 236 | static void obj_init(void) |
263 | { | 237 | { |
@@ -267,7 +241,7 @@ index b4f2c499..55bba4a1 100644 | |||
267 | any_segs = false; | 241 | any_segs = false; |
268 | fpubhead = NULL; | 242 | fpubhead = NULL; |
269 | diff --git a/stdlib/strlcat.c b/stdlib/strlcat.c | 243 | diff --git a/stdlib/strlcat.c b/stdlib/strlcat.c |
270 | index 7084d460..ee93dea3 100644 | 244 | index 7084d46..ee93dea 100644 |
271 | --- a/stdlib/strlcat.c | 245 | --- a/stdlib/strlcat.c |
272 | +++ b/stdlib/strlcat.c | 246 | +++ b/stdlib/strlcat.c |
273 | @@ -29,7 +29,7 @@ size_t strlcat(char *dest, const char *src, size_t size) | 247 | @@ -29,7 +29,7 @@ size_t strlcat(char *dest, const char *src, size_t size) |
@@ -281,7 +255,7 @@ index 7084d460..ee93dea3 100644 | |||
281 | /* destination was not NULL terminated. Return the initial size */ | 255 | /* destination was not NULL terminated. Return the initial size */ |
282 | diff --git a/test/elfdebugprefix.asm b/test/elfdebugprefix.asm | 256 | diff --git a/test/elfdebugprefix.asm b/test/elfdebugprefix.asm |
283 | new file mode 100644 | 257 | new file mode 100644 |
284 | index 00000000..a67ba29c | 258 | index 0000000..a67ba29 |
285 | --- /dev/null | 259 | --- /dev/null |
286 | +++ b/test/elfdebugprefix.asm | 260 | +++ b/test/elfdebugprefix.asm |
287 | @@ -0,0 +1,6 @@ | 261 | @@ -0,0 +1,6 @@ |
@@ -292,7 +266,7 @@ index 00000000..a67ba29c | |||
292 | + ret | 266 | + ret |
293 | + | 267 | + |
294 | diff --git a/test/performtest.pl b/test/performtest.pl | 268 | diff --git a/test/performtest.pl b/test/performtest.pl |
295 | index f7865b39..096f9604 100755 | 269 | index f7865b3..096f960 100755 |
296 | --- a/test/performtest.pl | 270 | --- a/test/performtest.pl |
297 | +++ b/test/performtest.pl | 271 | +++ b/test/performtest.pl |
298 | @@ -42,14 +42,22 @@ sub perform { | 272 | @@ -42,14 +42,22 @@ sub perform { |
@@ -320,6 +294,3 @@ index f7865b39..096f9604 100755 | |||
320 | #Move the output to the test dir | 294 | #Move the output to the test dir |
321 | mkpath("$outputdir/$testname/$subname"); | 295 | mkpath("$outputdir/$testname/$subname"); |
322 | foreach(split / /,$files) { | 296 | foreach(split / /,$files) { |
323 | -- | ||
324 | 2.23.0 | ||
325 | |||