diff --git a/ld/ldfile.c b/ld/ldfile.c index 6364469..2afe6c8 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -313,7 +313,7 @@ success: will be needed when and if we want to bfd_create a new one using this one as a template. */ if (bfd_check_format (entry->the_bfd, bfd_object) - && plugin_active_plugins_p ()) + && plugin_active_plugins_p ()) { int fd = open (attempt, O_RDONLY | O_BINARY); if (fd >= 0) @@ -330,7 +330,7 @@ success: file.handle = plugin_get_ir_dummy_bfd (attempt, entry->the_bfd); if (plugin_call_claim_file (&file, &claimed)) einfo (_("%P%F: %s: plugin reported error claiming file\n"), - plugin_error_plugin ()); + plugin_error_plugin ()); /* fd belongs to us, not the plugin; but we don't need it. */ close (fd); if (claimed) @@ -344,7 +344,7 @@ success: else { /* If plugin didn't claim the file, we don't need the dummy - bfd. Can't avoid speculatively creating it, alas. */ + bfd. Can't avoid speculatively creating it, alas. */ bfd_close_all_done (file.handle); entry->claimed = FALSE; } @@ -480,8 +480,8 @@ ldfile_open_file (lang_input_statement_type *entry) else { if (entry->sysrooted - && ld_sysroot - && IS_ABSOLUTE_PATH (entry->local_sym_name)) + && ld_sysroot + && IS_ABSOLUTE_PATH (entry->local_sym_name)) einfo (_("%P: cannot find %s inside %s\n"), entry->local_sym_name, ld_sysroot); else @@ -551,7 +551,7 @@ check_for_scripts_dir (char *dir) We look for the "ldscripts" directory in: SCRIPTDIR (passed from Makefile) - (adjusted according to the current location of the binary) + (adjusted according to the current location of the binary) the dir where this program is (for using it from the build tree). */ static char * @@ -687,7 +687,7 @@ ldfile_add_arch (const char *in_name) { char *name = xstrdup (in_name); search_arch_type *new_arch = (search_arch_type *) - xmalloc (sizeof (search_arch_type)); + xmalloc (sizeof (search_arch_type)); ldfile_output_machine_name = in_name; diff --git a/ld/plugin.c b/ld/plugin.c index c4337d9..a609179 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -261,15 +261,15 @@ is_ir_dummy_bfd (const bfd *abfd) /* Helpers to convert between BFD and GOLD symbol formats. */ static enum ld_plugin_status asymbol_from_plugin_symbol (bfd *abfd, asymbol *asym, - const struct ld_plugin_symbol *ldsym) + const struct ld_plugin_symbol *ldsym) { flagword flags = BSF_NO_FLAGS; struct bfd_section *section; asym->the_bfd = abfd; asym->name = ldsym->version - ? concat (ldsym->name, "@", ldsym->version, NULL) - : ldsym->name; + ? concat (ldsym->name, "@", ldsym->version, NULL) + : ldsym->name; asym->value = 0; switch (ldsym->def) { @@ -389,7 +389,7 @@ release_input_file (const void *handle) universe of claimed objects. */ static inline bfd_boolean is_visible_from_outside (struct ld_plugin_symbol *lsym, asection *section, - struct bfd_link_hash_entry *blhe) + struct bfd_link_hash_entry *blhe) { /* Section's owner may be NULL if it is the absolute section, fortunately is_ir_dummy_bfd handles that. */ @@ -407,7 +407,7 @@ is_visible_from_outside (struct ld_plugin_symbol *lsym, asection *section, return vis == STV_DEFAULT || vis == STV_PROTECTED; } /* On non-ELF targets, we can safely make inferences by considering - what visibility the plugin would have liked to apply when it first + what visibility the plugin would have liked to apply when it first sent us the symbol. During ELF symbol processing, visibility only ever becomes more restrictive, not less, when symbols are merged, so this is a conservative estimate; it may give false positives, @@ -417,7 +417,7 @@ is_visible_from_outside (struct ld_plugin_symbol *lsym, asection *section, negatives, which can lead to the disastrous conclusion that the related symbol is IRONLY. (See GCC PR46319 for an example.) */ return lsym->visibility == LDPV_DEFAULT - || lsym->visibility == LDPV_PROTECTED; + || lsym->visibility == LDPV_PROTECTED; } return FALSE; } @@ -436,7 +436,7 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms) asection *owner_sec; blhe = bfd_link_hash_lookup (link_info.hash, syms[n].name, - FALSE, FALSE, TRUE); + FALSE, FALSE, TRUE); if (!blhe) { syms[n].resolution = LDPR_UNKNOWN; @@ -445,36 +445,36 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms) /* Determine resolution from blhe type and symbol's original type. */ if (blhe->type == bfd_link_hash_undefined - || blhe->type == bfd_link_hash_undefweak) + || blhe->type == bfd_link_hash_undefweak) { syms[n].resolution = LDPR_UNDEF; continue; } if (blhe->type != bfd_link_hash_defined - && blhe->type != bfd_link_hash_defweak - && blhe->type != bfd_link_hash_common) + && blhe->type != bfd_link_hash_defweak + && blhe->type != bfd_link_hash_common) { /* We should not have a new, indirect or warning symbol here. */ einfo ("%P%F: %s: plugin symbol table corrupt (sym type %d)", - called_plugin->name, blhe->type); + called_plugin->name, blhe->type); } /* Find out which section owns the symbol. Since it's not undef, it must have an owner; if it's not a common symbol, both defs and weakdefs keep it in the same place. */ owner_sec = (blhe->type == bfd_link_hash_common) - ? blhe->u.c.p->section - : blhe->u.def.section; + ? blhe->u.c.p->section + : blhe->u.def.section; /* We need to know if the sym is referenced from non-IR files. Or - even potentially-referenced, perhaps in a future final link if + even potentially-referenced, perhaps in a future final link if this is a partial one, perhaps dynamically at load-time if the symbol is externally visible. */ ironly = !is_visible_from_outside (&syms[n], owner_sec, blhe) && !bfd_hash_lookup (non_ironly_hash, syms[n].name, FALSE, FALSE); /* If it was originally undefined or common, then it has been - resolved; determine how. */ + resolved; determine how. */ if (syms[n].def == LDPK_UNDEF || syms[n].def == LDPK_WEAKUNDEF || syms[n].def == LDPK_COMMON) { @@ -482,8 +482,8 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms) syms[n].resolution = LDPR_RESOLVED_EXEC; else if (owner_sec->owner == abfd) syms[n].resolution = (ironly) - ? LDPR_PREVAILING_DEF_IRONLY - : LDPR_PREVAILING_DEF; + ? LDPR_PREVAILING_DEF_IRONLY + : LDPR_PREVAILING_DEF; else if (is_ir_dummy_bfd (owner_sec->owner)) syms[n].resolution = LDPR_RESOLVED_IR; else if (owner_sec->owner->flags & DYNAMIC) @@ -494,22 +494,22 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms) } /* Was originally def, or weakdef. Does it prevail? If the - owner is the original dummy bfd that supplied it, then this + owner is the original dummy bfd that supplied it, then this is the definition that has prevailed. */ if (owner_sec->owner == link_info.output_bfd) syms[n].resolution = LDPR_PREEMPTED_REG; else if (owner_sec->owner == abfd) { syms[n].resolution = (ironly) - ? LDPR_PREVAILING_DEF_IRONLY - : LDPR_PREVAILING_DEF; + ? LDPR_PREVAILING_DEF_IRONLY + : LDPR_PREVAILING_DEF; continue; } /* Was originally def, weakdef, or common, but has been pre-empted. */ syms[n].resolution = is_ir_dummy_bfd (owner_sec->owner) - ? LDPR_PREEMPTED_IR - : LDPR_PREEMPTED_REG; + ? LDPR_PREEMPTED_IR + : LDPR_PREEMPTED_REG; } return LDPS_OK; } @@ -520,7 +520,7 @@ add_input_file (const char *pathname) { ASSERT (called_plugin); if (!lang_add_input_file (xstrdup (pathname), lang_input_file_is_file_enum, - NULL)) + NULL)) return LDPS_ERR; return LDPS_OK; } @@ -531,7 +531,7 @@ add_input_library (const char *pathname) { ASSERT (called_plugin); if (!lang_add_input_file (xstrdup (pathname), lang_input_file_is_l_enum, - NULL)) + NULL)) return LDPS_ERR; return LDPS_OK; } @@ -564,11 +564,11 @@ message (int level, const char *format, ...) case LDPL_FATAL: case LDPL_ERROR: default: - { - char *newfmt = ACONCAT ((level == LDPL_FATAL ? "%F" : "%X", - format, NULL)); - vfinfo (stderr, newfmt, args, TRUE); - } + { + char *newfmt = ACONCAT ((level == LDPL_FATAL ? "%F" : "%X", + format, NULL)); + vfinfo (stderr, newfmt, args, TRUE); + } break; } @@ -595,56 +595,56 @@ set_tv_header (struct ld_plugin_tv *tv) #define TVU(x) tv[i].tv_u.tv_ ## x switch (tv[i].tv_tag) { - case LDPT_MESSAGE: - TVU(message) = message; - break; - case LDPT_API_VERSION: - TVU(val) = LD_PLUGIN_API_VERSION; - break; - case LDPT_GNU_LD_VERSION: - TVU(val) = major * 100 + minor; - break; - case LDPT_LINKER_OUTPUT: - TVU(val) = link_info.relocatable ? LDPO_REL - : (link_info.shared ? LDPO_DYN : LDPO_EXEC); - break; - case LDPT_OUTPUT_NAME: - TVU(string) = output_filename; - break; - case LDPT_REGISTER_CLAIM_FILE_HOOK: - TVU(register_claim_file) = register_claim_file; - break; - case LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK: - TVU(register_all_symbols_read) = register_all_symbols_read; - break; - case LDPT_REGISTER_CLEANUP_HOOK: - TVU(register_cleanup) = register_cleanup; - break; - case LDPT_ADD_SYMBOLS: - TVU(add_symbols) = add_symbols; - break; - case LDPT_GET_INPUT_FILE: - TVU(get_input_file) = get_input_file; - break; - case LDPT_RELEASE_INPUT_FILE: - TVU(release_input_file) = release_input_file; - break; - case LDPT_GET_SYMBOLS: - TVU(get_symbols) = get_symbols; - break; - case LDPT_ADD_INPUT_FILE: - TVU(add_input_file) = add_input_file; - break; - case LDPT_ADD_INPUT_LIBRARY: - TVU(add_input_library) = add_input_library; - break; - case LDPT_SET_EXTRA_LIBRARY_PATH: - TVU(set_extra_library_path) = set_extra_library_path; - break; - default: - /* Added a new entry to the array without adding - a new case to set up its value is a bug. */ - FAIL (); + case LDPT_MESSAGE: + TVU(message) = message; + break; + case LDPT_API_VERSION: + TVU(val) = LD_PLUGIN_API_VERSION; + break; + case LDPT_GNU_LD_VERSION: + TVU(val) = major * 100 + minor; + break; + case LDPT_LINKER_OUTPUT: + TVU(val) = link_info.relocatable ? LDPO_REL + : (link_info.shared ? LDPO_DYN : LDPO_EXEC); + break; + case LDPT_OUTPUT_NAME: + TVU(string) = output_filename; + break; + case LDPT_REGISTER_CLAIM_FILE_HOOK: + TVU(register_claim_file) = register_claim_file; + break; + case LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK: + TVU(register_all_symbols_read) = register_all_symbols_read; + break; + case LDPT_REGISTER_CLEANUP_HOOK: + TVU(register_cleanup) = register_cleanup; + break; + case LDPT_ADD_SYMBOLS: + TVU(add_symbols) = add_symbols; + break; + case LDPT_GET_INPUT_FILE: + TVU(get_input_file) = get_input_file; + break; + case LDPT_RELEASE_INPUT_FILE: + TVU(release_input_file) = release_input_file; + break; + case LDPT_GET_SYMBOLS: + TVU(get_symbols) = get_symbols; + break; + case LDPT_ADD_INPUT_FILE: + TVU(add_input_file) = add_input_file; + break; + case LDPT_ADD_INPUT_LIBRARY: + TVU(add_input_library) = add_input_library; + break; + case LDPT_SET_EXTRA_LIBRARY_PATH: + TVU(set_extra_library_path) = set_extra_library_path; + break; + default: + /* Added a new entry to the array without adding + a new case to set up its value is a bug. */ + FAIL (); } #undef TVU } @@ -709,13 +709,13 @@ plugin_load_plugins (void) if (!onloadfn) onloadfn = dlsym (curplug->dlhandle, "_onload"); if (!onloadfn) - return set_plugin_error (curplug->name); + return set_plugin_error (curplug->name); set_tv_plugin_args (curplug, &my_tv[tv_header_size]); called_plugin = curplug; rv = (*onloadfn) (my_tv); called_plugin = NULL; if (rv != LDPS_OK) - return set_plugin_error (curplug->name); + return set_plugin_error (curplug->name); curplug = curplug->next; } @@ -813,7 +813,7 @@ init_non_ironly_hash (void) if (non_ironly_hash == NULL) { non_ironly_hash = - (struct bfd_hash_table *) xmalloc (sizeof (struct bfd_hash_table)); + (struct bfd_hash_table *) xmalloc (sizeof (struct bfd_hash_table)); if (!bfd_hash_table_init_n (non_ironly_hash, bfd_hash_newfunc, sizeof (struct bfd_hash_entry), @@ -832,8 +832,8 @@ init_non_ironly_hash (void) contributed by IR files. */ bfd_boolean plugin_notice (struct bfd_link_info *info ATTRIBUTE_UNUSED, - const char *name, bfd *abfd, - asection *section, bfd_vma value ATTRIBUTE_UNUSED) + const char *name, bfd *abfd, + asection *section, bfd_vma value ATTRIBUTE_UNUSED) { bfd_boolean is_ref = bfd_is_und_section (section); bfd_boolean is_dummy = is_ir_dummy_bfd (abfd); @@ -844,10 +844,10 @@ plugin_notice (struct bfd_link_info *info ATTRIBUTE_UNUSED, if (is_ref && !is_dummy) { /* This is a ref from a non-IR file, so note the ref'd symbol - in the non-IR-only hash. */ + in the non-IR-only hash. */ if (!bfd_hash_lookup (non_ironly_hash, name, TRUE, TRUE)) - einfo (_("%P%X: %s: hash table failure adding symbol %s"), - abfd->filename, name); + einfo (_("%P%X: %s: hash table failure adding symbol %s"), + abfd->filename, name); } else if (!is_ref && is_dummy) { @@ -870,17 +870,17 @@ plugin_notice (struct bfd_link_info *info ATTRIBUTE_UNUSED, effect (before we disabled it to ensure we got called back). */ bfd_boolean plugin_multiple_definition (struct bfd_link_info *info, const char *name, - bfd *obfd, asection *osec ATTRIBUTE_UNUSED, - bfd_vma oval ATTRIBUTE_UNUSED, - bfd *nbfd, asection *nsec, bfd_vma nval) + bfd *obfd, asection *osec ATTRIBUTE_UNUSED, + bfd_vma oval ATTRIBUTE_UNUSED, + bfd *nbfd, asection *nsec, bfd_vma nval) { if (is_ir_dummy_bfd (obfd)) { struct bfd_link_hash_entry *blhe = bfd_link_hash_lookup (info->hash, - name, FALSE, FALSE, FALSE); + name, FALSE, FALSE, FALSE); if (!blhe) einfo (_("%P%X: %s: can't find IR symbol '%s'"), nbfd->filename, - name); + name); else if (blhe->type != bfd_link_hash_defined) einfo (_("%P%x: %s: bad IR symbol type %d"), name, blhe->type); /* Replace it with new details. */