diff options
author | dvshkurko <dvshkurko@yandex-team.ru> | 2022-02-10 16:45:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:52 +0300 |
commit | c768a99151e47c3a4bb7b92c514d256abd301c4d (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/tools | |
parent | 321ee9bce31ec6e238be26dbcbe539cffa2c3309 (diff) | |
download | ydb-c768a99151e47c3a4bb7b92c514d256abd301c4d.tar.gz |
Restoring authorship annotation for <dvshkurko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools')
-rw-r--r-- | contrib/tools/protoc/plugins/grpc_cpp/ya.make | 6 | ||||
-rw-r--r-- | contrib/tools/protoc/plugins/grpc_python/ya.make | 6 | ||||
-rw-r--r-- | contrib/tools/yasm/frontends/yasm/yasm.c | 74 | ||||
-rw-r--r-- | contrib/tools/yasm/libyasm/dbgfmt.h | 18 | ||||
-rw-r--r-- | contrib/tools/yasm/libyasm/objfmt.h | 18 | ||||
-rw-r--r-- | contrib/tools/yasm/libyasm/replace_path.c | 108 | ||||
-rw-r--r-- | contrib/tools/yasm/libyasm/section.c | 8 | ||||
-rw-r--r-- | contrib/tools/yasm/libyasm/section.h | 2 | ||||
-rw-r--r-- | contrib/tools/yasm/modules/dbgfmts/dwarf2/dwarf2-info.c | 22 | ||||
-rw-r--r-- | contrib/tools/yasm/modules/dbgfmts/dwarf2/dwarf2-line.c | 30 | ||||
-rw-r--r-- | contrib/tools/yasm/modules/init_plugin.c | 40 | ||||
-rw-r--r-- | contrib/tools/yasm/modules/objfmts/coff/coff-objfmt.c | 12 | ||||
-rw-r--r-- | contrib/tools/yasm/modules/objfmts/elf/elf-objfmt.c | 24 | ||||
-rw-r--r-- | contrib/tools/yasm/util.h | 4 |
14 files changed, 186 insertions, 186 deletions
diff --git a/contrib/tools/protoc/plugins/grpc_cpp/ya.make b/contrib/tools/protoc/plugins/grpc_cpp/ya.make index 90dc1dc94b..7add4ebbad 100644 --- a/contrib/tools/protoc/plugins/grpc_cpp/ya.make +++ b/contrib/tools/protoc/plugins/grpc_cpp/ya.make @@ -1,6 +1,6 @@ -# Copy of contrib/libs/grpc/src/compiler/grpc_cpp_plugin -# Generated by devtools/yamaker. - +# Copy of contrib/libs/grpc/src/compiler/grpc_cpp_plugin +# Generated by devtools/yamaker. + OWNER(akastornov g:contrib g:cpp-contrib) IF (USE_PREBUILT_TOOLS) diff --git a/contrib/tools/protoc/plugins/grpc_python/ya.make b/contrib/tools/protoc/plugins/grpc_python/ya.make index 3632059e72..1852d8b6fd 100644 --- a/contrib/tools/protoc/plugins/grpc_python/ya.make +++ b/contrib/tools/protoc/plugins/grpc_python/ya.make @@ -1,6 +1,6 @@ -# Copy of contrib/libs/grpc/src/compiler/grpc_python_plugin -# Generated by devtools/yamaker. - +# Copy of contrib/libs/grpc/src/compiler/grpc_python_plugin +# Generated by devtools/yamaker. + OWNER(akastornov g:contrib g:cpp-contrib) IF (USE_PREBUILT_TOOLS) diff --git a/contrib/tools/yasm/frontends/yasm/yasm.c b/contrib/tools/yasm/frontends/yasm/yasm.c index 57911326b0..2bd08890df 100644 --- a/contrib/tools/yasm/frontends/yasm/yasm.c +++ b/contrib/tools/yasm/frontends/yasm/yasm.c @@ -50,9 +50,9 @@ /*@null@*/ /*@only@*/ static char *global_prefix = NULL, *global_suffix = NULL; /*@null@*/ /*@only@*/ static char *list_filename = NULL, *map_filename = NULL; /*@null@*/ /*@only@*/ static char *machine_name = NULL; -static char **replace_params; -static int replace_size = 0; -static int replace_capacity = 0; +static char **replace_params; +static int replace_size = 0; +static int replace_capacity = 0; static int special_options = 0; /*@null@*/ /*@dependent@*/ static yasm_arch *cur_arch = NULL; /*@null@*/ /*@dependent@*/ static const yasm_arch_module * @@ -110,7 +110,7 @@ static int opt_preproc_option(char *cmd, /*@null@*/ char *param, int extra); static int opt_ewmsg_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_makedep_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_prefix_handler(char *cmd, /*@null@*/ char *param, int extra); -static int opt_replace_handler(char *cmd, /*@null@*/ char *param, int extra); +static int opt_replace_handler(char *cmd, /*@null@*/ char *param, int extra); static int opt_suffix_handler(char *cmd, /*@null@*/ char *param, int extra); #if defined(CMAKE_BUILD) && defined(BUILD_SHARED_LIBS) static int opt_plugin_handler(char *cmd, /*@null@*/ char *param, int extra); @@ -118,7 +118,7 @@ static int opt_plugin_handler(char *cmd, /*@null@*/ char *param, int extra); #if defined(CMAKE_BUILD) && !defined(BUILD_SHARED_LIBS) void yasm_init_plugin(void); -void yasm_plugin_set_replace(const char* replace[], int size); +void yasm_plugin_set_replace(const char* replace[], int size); #endif static /*@only@*/ char *replace_extension(const char *orig, /*@null@*/ @@ -217,8 +217,8 @@ static opt_option options[] = { 'N', "plugin", 1, opt_plugin_handler, 0, N_("load plugin module"), N_("plugin") }, #endif - { 0, "replace", 1, opt_replace_handler, 0, - N_("replace names"), N_("replace") }, + { 0, "replace", 1, opt_replace_handler, 0, + N_("replace names"), N_("replace") }, }; /* version message */ @@ -663,10 +663,10 @@ main(int argc, char *argv[]) return EXIT_FAILURE; } -#if defined(CMAKE_BUILD) && !defined(BUILD_SHARED_LIBS) - yasm_plugin_set_replace(replace_params, replace_size); -#endif - +#if defined(CMAKE_BUILD) && !defined(BUILD_SHARED_LIBS) + yasm_plugin_set_replace(replace_params, replace_size); +#endif + /* If not already specified, default to bin as the object format. */ if (!cur_objfmt_module) { if (!objfmt_keyword) @@ -1199,33 +1199,33 @@ opt_prefix_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) return 0; } -static void -opt_free_replace(void) -{ - yasm_xfree(replace_params); - replace_capacity = 0; - replace_size = 0; -} - +static void +opt_free_replace(void) +{ + yasm_xfree(replace_params); + replace_capacity = 0; + replace_size = 0; +} + +static int +opt_replace_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) +{ + if (replace_capacity == 0) { + atexit(opt_free_replace); + } + if (replace_size == replace_capacity) { + replace_capacity += 10; + replace_params = yasm_xrealloc(replace_params, replace_capacity); + } + + assert(param != NULL); + replace_params[replace_size] = yasm__xstrdup(param); + ++replace_size; + + return 0; +} + static int -opt_replace_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) -{ - if (replace_capacity == 0) { - atexit(opt_free_replace); - } - if (replace_size == replace_capacity) { - replace_capacity += 10; - replace_params = yasm_xrealloc(replace_params, replace_capacity); - } - - assert(param != NULL); - replace_params[replace_size] = yasm__xstrdup(param); - ++replace_size; - - return 0; -} - -static int opt_suffix_handler(/*@unused@*/ char *cmd, char *param, /*@unused@*/ int extra) { if (global_suffix) diff --git a/contrib/tools/yasm/libyasm/dbgfmt.h b/contrib/tools/yasm/libyasm/dbgfmt.h index fb5bf4cfbb..2e5ea867ee 100644 --- a/contrib/tools/yasm/libyasm/dbgfmt.h +++ b/contrib/tools/yasm/libyasm/dbgfmt.h @@ -69,15 +69,15 @@ struct yasm_dbgfmt_module { */ void (*generate) (yasm_object *object, yasm_linemap *linemap, yasm_errwarns *errwarns); - - /** - * --replace params - */ - const char** replace_map; - /** - * Number of elements in replace_map - */ - int replace_map_size; + + /** + * --replace params + */ + const char** replace_map; + /** + * Number of elements in replace_map + */ + int replace_map_size; }; /** Get the keyword used to select a debug format. diff --git a/contrib/tools/yasm/libyasm/objfmt.h b/contrib/tools/yasm/libyasm/objfmt.h index 48e26a7ce9..a8b5f8a161 100644 --- a/contrib/tools/yasm/libyasm/objfmt.h +++ b/contrib/tools/yasm/libyasm/objfmt.h @@ -123,15 +123,15 @@ struct yasm_objfmt_module { /*@observer@*/ /*@null@*/ yasm_symrec * (*get_special_sym)(yasm_object *object, const char *name, const char *parser); - - /** - * --replace params - */ - const char** replace_map; - /** - * Number of elements in replace_map - */ - int replace_map_size; + + /** + * --replace params + */ + const char** replace_map; + /** + * Number of elements in replace_map + */ + int replace_map_size; }; /** Create object format. diff --git a/contrib/tools/yasm/libyasm/replace_path.c b/contrib/tools/yasm/libyasm/replace_path.c index b0301ef705..0deba70a6b 100644 --- a/contrib/tools/yasm/libyasm/replace_path.c +++ b/contrib/tools/yasm/libyasm/replace_path.c @@ -1,54 +1,54 @@ -/* - * Copyright (c) 1988, 1993, 2019 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#include "util.h" - -char * yasm_replace_path(const char* replace_map[], int size, const char* str, int pref_len) { - int i; - for (i=0; i<size; i++) { - const char* pos = strchr(replace_map[i], '='); - if (!pos) { - continue; - } - int repl_size = pos - replace_map[i]; - if (pref_len < repl_size) { - continue; - } - if (strncmp(replace_map[i], str, repl_size)) { - continue; - } - int subs_size = strlen(replace_map[i]) - (repl_size + 1); - int size = subs_size + pref_len - repl_size + 1; - char* out = yasm_xmalloc(size); - strncpy(out, pos + 1, subs_size); - strncpy(out + subs_size, str + repl_size, pref_len - repl_size); - out[size - 1] = '\0'; - return out; - } - return yasm__xstrndup(str, pref_len); -} +/* + * Copyright (c) 1988, 1993, 2019 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include "util.h" + +char * yasm_replace_path(const char* replace_map[], int size, const char* str, int pref_len) { + int i; + for (i=0; i<size; i++) { + const char* pos = strchr(replace_map[i], '='); + if (!pos) { + continue; + } + int repl_size = pos - replace_map[i]; + if (pref_len < repl_size) { + continue; + } + if (strncmp(replace_map[i], str, repl_size)) { + continue; + } + int subs_size = strlen(replace_map[i]) - (repl_size + 1); + int size = subs_size + pref_len - repl_size + 1; + char* out = yasm_xmalloc(size); + strncpy(out, pos + 1, subs_size); + strncpy(out + subs_size, str + repl_size, pref_len - repl_size); + out[size - 1] = '\0'; + return out; + } + return yasm__xstrndup(str, pref_len); +} diff --git a/contrib/tools/yasm/libyasm/section.c b/contrib/tools/yasm/libyasm/section.c index 903d3eb1fe..729d7770a4 100644 --- a/contrib/tools/yasm/libyasm/section.c +++ b/contrib/tools/yasm/libyasm/section.c @@ -220,7 +220,7 @@ yasm_object_create(const char *src_filename, const char *obj_filename, int matched, i; object->src_filename = yasm__xstrdup(src_filename); - object->deb_filename = NULL; + object->deb_filename = NULL; object->obj_filename = yasm__xstrdup(obj_filename); /* No prefix/suffix */ @@ -385,8 +385,8 @@ yasm_object_set_source_fn(yasm_object *object, const char *src_filename) { yasm_xfree(object->src_filename); object->src_filename = yasm__xstrdup(src_filename); - yasm_xfree(object->deb_filename); - object->deb_filename = NULL; + yasm_xfree(object->deb_filename); + object->deb_filename = NULL; } void @@ -483,7 +483,7 @@ yasm_object_destroy(yasm_object *object) /* Delete associated filenames */ yasm_xfree(object->src_filename); - yasm_xfree(object->deb_filename); + yasm_xfree(object->deb_filename); yasm_xfree(object->obj_filename); /* Delete symbol table */ diff --git a/contrib/tools/yasm/libyasm/section.h b/contrib/tools/yasm/libyasm/section.h index 7ed9696725..521031f3a5 100644 --- a/contrib/tools/yasm/libyasm/section.h +++ b/contrib/tools/yasm/libyasm/section.h @@ -48,7 +48,7 @@ struct yasm_reloc { /** An object. This is the internal representation of an object file. */ struct yasm_object { /*@owned@*/ char *src_filename; /**< Source filename */ - /*@owned@*/ char *deb_filename; /**< Debug filename */ + /*@owned@*/ char *deb_filename; /**< Debug filename */ /*@owned@*/ char *obj_filename; /**< Object filename */ /*@owned@*/ yasm_symtab *symtab; /**< Symbol table */ diff --git a/contrib/tools/yasm/modules/dbgfmts/dwarf2/dwarf2-info.c b/contrib/tools/yasm/modules/dbgfmts/dwarf2/dwarf2-info.c index 667665e89c..96d24db06a 100644 --- a/contrib/tools/yasm/modules/dbgfmts/dwarf2/dwarf2-info.c +++ b/contrib/tools/yasm/modules/dbgfmts/dwarf2/dwarf2-info.c @@ -326,21 +326,21 @@ yasm_dwarf2__generate_info(yasm_object *object, yasm_section *debug_line, /* input filename */ abc->len += dwarf2_add_abbrev_attr(abbrev, DW_AT_name, DW_FORM_string); - if (!object->deb_filename) { - object->deb_filename = yasm_replace_path( - dbgfmt_dwarf2->dbgfmt.module->replace_map, dbgfmt_dwarf2->dbgfmt.module->replace_map_size, - object->src_filename, strlen(object->src_filename)); - } - dwarf2_append_str(debug_info, object->deb_filename); + if (!object->deb_filename) { + object->deb_filename = yasm_replace_path( + dbgfmt_dwarf2->dbgfmt.module->replace_map, dbgfmt_dwarf2->dbgfmt.module->replace_map_size, + object->src_filename, strlen(object->src_filename)); + } + dwarf2_append_str(debug_info, object->deb_filename); /* compile directory (current working directory) */ abc->len += dwarf2_add_abbrev_attr(abbrev, DW_AT_comp_dir, DW_FORM_string); buf = yasm__getcwd(); - char * new_cwd_name = yasm_replace_path( - dbgfmt_dwarf2->dbgfmt.module->replace_map, dbgfmt_dwarf2->dbgfmt.module->replace_map_size, - buf, strlen(buf)); - dwarf2_append_str(debug_info, new_cwd_name); - yasm_xfree(new_cwd_name); + char * new_cwd_name = yasm_replace_path( + dbgfmt_dwarf2->dbgfmt.module->replace_map, dbgfmt_dwarf2->dbgfmt.module->replace_map_size, + buf, strlen(buf)); + dwarf2_append_str(debug_info, new_cwd_name); + yasm_xfree(new_cwd_name); yasm_xfree(buf); /* producer - assembler name */ diff --git a/contrib/tools/yasm/modules/dbgfmts/dwarf2/dwarf2-line.c b/contrib/tools/yasm/modules/dbgfmts/dwarf2/dwarf2-line.c index 8f21363be9..14639ca429 100644 --- a/contrib/tools/yasm/modules/dbgfmts/dwarf2/dwarf2-line.c +++ b/contrib/tools/yasm/modules/dbgfmts/dwarf2/dwarf2-line.c @@ -532,21 +532,21 @@ dwarf2_generate_line_bc(yasm_bytecode *bc, /*@null@*/ void *d) yasm_linemap_lookup(info->linemap, bc->line, &pathname, &info->loc.line); dirlen = yasm__splitpath(pathname, &filename); - char * new_dir_name = yasm_replace_path( - dbgfmt_dwarf2->dbgfmt.module->replace_map, dbgfmt_dwarf2->dbgfmt.module->replace_map_size, - pathname, dirlen); - dirlen = strlen(new_dir_name); + char * new_dir_name = yasm_replace_path( + dbgfmt_dwarf2->dbgfmt.module->replace_map, dbgfmt_dwarf2->dbgfmt.module->replace_map_size, + pathname, dirlen); + dirlen = strlen(new_dir_name); /* Find file index; just linear search it unless it was the last used */ if (info->lastfile > 0 && dwarf2_filename_equals(&dbgfmt_dwarf2->filenames[info->lastfile-1], - dbgfmt_dwarf2->dirs, new_dir_name, dirlen, + dbgfmt_dwarf2->dirs, new_dir_name, dirlen, filename)) info->loc.file = info->lastfile; else { for (i=0; i<dbgfmt_dwarf2->filenames_size; i++) { if (dwarf2_filename_equals(&dbgfmt_dwarf2->filenames[i], - dbgfmt_dwarf2->dirs, new_dir_name, dirlen, + dbgfmt_dwarf2->dirs, new_dir_name, dirlen, filename)) break; } @@ -555,7 +555,7 @@ dwarf2_generate_line_bc(yasm_bytecode *bc, /*@null@*/ void *d) info->loc.file = i+1; info->lastfile = i+1; } - yasm_xfree(new_dir_name); + yasm_xfree(new_dir_name); if (dwarf2_dbgfmt_gen_line_op(info->debug_line, info->state, &info->loc, NULL)) return 1; @@ -682,11 +682,11 @@ static int dwarf2_generate_filename(const char *filename, void *d) { yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2 = (yasm_dbgfmt_dwarf2 *)d; - char *deb_name = yasm_replace_path( - dbgfmt_dwarf2->dbgfmt.module->replace_map, dbgfmt_dwarf2->dbgfmt.module->replace_map_size, - filename, strlen(filename)); - dwarf2_dbgfmt_add_file(dbgfmt_dwarf2, 0, deb_name); - yasm_xfree(deb_name); + char *deb_name = yasm_replace_path( + dbgfmt_dwarf2->dbgfmt.module->replace_map, dbgfmt_dwarf2->dbgfmt.module->replace_map_size, + filename, strlen(filename)); + dwarf2_dbgfmt_add_file(dbgfmt_dwarf2, 0, deb_name); + yasm_xfree(deb_name); return 0; } @@ -1130,9 +1130,9 @@ yasm_dwarf2__dir_file(yasm_object *object, yasm_valparamhead *valparams, if (yasm_vp_string(vp)) { /* Just a bare filename */ yasm_object_set_source_fn(object, yasm_vp_string(vp)); - object->deb_filename = yasm_replace_path( - dbgfmt_dwarf2->dbgfmt.module->replace_map, dbgfmt_dwarf2->dbgfmt.module->replace_map_size, - yasm_vp_string(vp), strlen(yasm_vp_string(vp))); + object->deb_filename = yasm_replace_path( + dbgfmt_dwarf2->dbgfmt.module->replace_map, dbgfmt_dwarf2->dbgfmt.module->replace_map_size, + yasm_vp_string(vp), strlen(yasm_vp_string(vp))); return; } diff --git a/contrib/tools/yasm/modules/init_plugin.c b/contrib/tools/yasm/modules/init_plugin.c index e4ca32da7f..86ae4c53f9 100644 --- a/contrib/tools/yasm/modules/init_plugin.c +++ b/contrib/tools/yasm/modules/init_plugin.c @@ -64,23 +64,23 @@ yasm_init_plugin(void) yasm_register_module(YASM_MODULE_OBJFMT, "xdf", &yasm_xdf_LTX_objfmt); } -void -yasm_plugin_set_replace(const char* replace_params[], int size) { - yasm_dwarf2_LTX_dbgfmt.replace_map = replace_params; - yasm_dwarf2_LTX_dbgfmt.replace_map_size = size; - yasm_elf_LTX_objfmt.replace_map = replace_params; - yasm_elf_LTX_objfmt.replace_map_size = size; - yasm_elf32_LTX_objfmt.replace_map = replace_params; - yasm_elf32_LTX_objfmt.replace_map_size = size; - yasm_elf64_LTX_objfmt.replace_map = replace_params; - yasm_elf64_LTX_objfmt.replace_map_size = size; - yasm_elfx32_LTX_objfmt.replace_map = replace_params; - yasm_elfx32_LTX_objfmt.replace_map_size = size; - - yasm_macho_LTX_objfmt.replace_map = replace_params; - yasm_macho_LTX_objfmt.replace_map_size = size; - yasm_macho32_LTX_objfmt.replace_map = replace_params; - yasm_macho32_LTX_objfmt.replace_map_size = size; - yasm_macho64_LTX_objfmt.replace_map = replace_params; - yasm_macho64_LTX_objfmt.replace_map_size = size; -} +void +yasm_plugin_set_replace(const char* replace_params[], int size) { + yasm_dwarf2_LTX_dbgfmt.replace_map = replace_params; + yasm_dwarf2_LTX_dbgfmt.replace_map_size = size; + yasm_elf_LTX_objfmt.replace_map = replace_params; + yasm_elf_LTX_objfmt.replace_map_size = size; + yasm_elf32_LTX_objfmt.replace_map = replace_params; + yasm_elf32_LTX_objfmt.replace_map_size = size; + yasm_elf64_LTX_objfmt.replace_map = replace_params; + yasm_elf64_LTX_objfmt.replace_map_size = size; + yasm_elfx32_LTX_objfmt.replace_map = replace_params; + yasm_elfx32_LTX_objfmt.replace_map_size = size; + + yasm_macho_LTX_objfmt.replace_map = replace_params; + yasm_macho_LTX_objfmt.replace_map_size = size; + yasm_macho32_LTX_objfmt.replace_map = replace_params; + yasm_macho32_LTX_objfmt.replace_map_size = size; + yasm_macho64_LTX_objfmt.replace_map = replace_params; + yasm_macho64_LTX_objfmt.replace_map_size = size; +} diff --git a/contrib/tools/yasm/modules/objfmts/coff/coff-objfmt.c b/contrib/tools/yasm/modules/objfmts/coff/coff-objfmt.c index 9f7e76bd30..388b09af32 100644 --- a/contrib/tools/yasm/modules/objfmts/coff/coff-objfmt.c +++ b/contrib/tools/yasm/modules/objfmts/coff/coff-objfmt.c @@ -1192,13 +1192,13 @@ coff_objfmt_output(yasm_object *object, FILE *f, int all_syms, if (objfmt_coff->filesym_data->aux[0].fname) yasm_xfree(objfmt_coff->filesym_data->aux[0].fname); - if (!object->deb_filename) { - object->deb_filename = yasm_replace_path( - objfmt_coff->objfmt.module->replace_map, objfmt_coff->objfmt.module->replace_map_size, - object->src_filename, strlen(object->src_filename)); - } + if (!object->deb_filename) { + object->deb_filename = yasm_replace_path( + objfmt_coff->objfmt.module->replace_map, objfmt_coff->objfmt.module->replace_map_size, + object->src_filename, strlen(object->src_filename)); + } objfmt_coff->filesym_data->aux[0].fname = - yasm__xstrdup(object->deb_filename); + yasm__xstrdup(object->deb_filename); /* Force all syms for win64 because they're needed for relocations. * FIXME: Not *all* syms need to be output, only the ones needed for diff --git a/contrib/tools/yasm/modules/objfmts/elf/elf-objfmt.c b/contrib/tools/yasm/modules/objfmts/elf/elf-objfmt.c index 20fc1dec0d..6874a1689f 100644 --- a/contrib/tools/yasm/modules/objfmts/elf/elf-objfmt.c +++ b/contrib/tools/yasm/modules/objfmts/elf/elf-objfmt.c @@ -370,14 +370,14 @@ elf_objfmt_create_common(yasm_object *object, yasm_objfmt_module *module, /* FIXME: misuse of NULL bytecode here; it works, but only barely. */ filesym = yasm_symtab_define_label(object->symtab, ".file", NULL, 0, 0); - if (!object->deb_filename) { - object->deb_filename = yasm_replace_path( - module->replace_map, module->replace_map_size, - object->src_filename, strlen(object->src_filename)); - } + if (!object->deb_filename) { + object->deb_filename = yasm_replace_path( + module->replace_map, module->replace_map_size, + object->src_filename, strlen(object->src_filename)); + } /* Put in current input filename; we'll replace it in output() */ objfmt_elf->file_strtab_entry = - elf_strtab_append_str(objfmt_elf->strtab, object->deb_filename); + elf_strtab_append_str(objfmt_elf->strtab, object->deb_filename); entry = elf_symtab_entry_create(objfmt_elf->file_strtab_entry, filesym); yasm_symrec_add_data(filesym, &elf_symrec_data, entry); elf_symtab_set_nonzero(entry, NULL, SHN_ABS, STB_LOCAL, STT_FILE, NULL, @@ -758,14 +758,14 @@ elf_objfmt_output(yasm_object *object, FILE *f, int all_syms, info.f = f; info.GOT_sym = yasm_symtab_get(object->symtab, "_GLOBAL_OFFSET_TABLE_"); - if (!object->deb_filename) { - object->deb_filename = yasm_replace_path( - objfmt_elf->objfmt.module->replace_map, objfmt_elf->objfmt.module->replace_map_size, - object->src_filename, strlen(object->src_filename)); - } + if (!object->deb_filename) { + object->deb_filename = yasm_replace_path( + objfmt_elf->objfmt.module->replace_map, objfmt_elf->objfmt.module->replace_map_size, + object->src_filename, strlen(object->src_filename)); + } /* Update filename strtab */ elf_strtab_entry_set_str(objfmt_elf->file_strtab_entry, - object->deb_filename); + object->deb_filename); /* Allocate space for Ehdr by seeking forward */ if (fseek(f, (long)(elf_proghead_get_size()), SEEK_SET) < 0) { diff --git a/contrib/tools/yasm/util.h b/contrib/tools/yasm/util.h index 48c77a2555..4174648a22 100644 --- a/contrib/tools/yasm/util.h +++ b/contrib/tools/yasm/util.h @@ -162,6 +162,6 @@ __asm__(".symver memcpy,memcpy@GLIBC_2.2.5"); #define NELEMS(array) (sizeof(array) / sizeof(array[0])) #endif -char * yasm_replace_path(const char* replace_map[], int size, const char* str, int pref_len); - +char * yasm_replace_path(const char* replace_map[], int size, const char* str, int pref_len); + #endif |