From f38a2680c2f04db6eac4fd87380cd3cf7bcb3bcc Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 31 Mar 2021 10:39:51 +1030 Subject: Use bool in ld * sysdep.h (POISON_BFD_BOOLEAN): Define. * configure.ac (elf_list_options, elf_shlib_list_options=false), (elf_plt_unwind_list_options=false): Replace FALSE with false, and TRUE with true. * emulparams/call_nop.sh, * emulparams/cet.sh, * emulparams/dynamic_undefined_weak.sh, * emulparams/elf32b4300.sh, * emulparams/elf32lm32.sh, * emulparams/elf32lr5900.sh, * emulparams/elf32lr5900n32.sh, * emulparams/elf32visium.sh, * emulparams/elf_x86_64.sh, * emulparams/extern_protected_data.sh, * emulparams/plt_unwind.sh, * emulparams/reloc_overflow.sh, * emulparams/static.sh, * emulparams/x86-64-lam.sh, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/alphaelf.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/avrelf.em, * emultempl/beos.em, * emultempl/bfin.em, * emultempl/cr16elf.em, * emultempl/crxelf.em, * emultempl/cskyelf.em, * emultempl/elf.em, * emultempl/genelf.em, * emultempl/hppaelf.em, * emultempl/linux.em, * emultempl/m68hc1xelf.em, * emultempl/metagelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmixelf.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pdp11.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc32elf.em, * emultempl/ppc64elf.em, * emultempl/rxelf.em, * emultempl/rxlinux.em, * emultempl/scoreelf.em, * emultempl/solaris2.em, * emultempl/spuelf.em, * emultempl/ticoff.em, * emultempl/v850elf.em, * emultempl/vms.em, * emultempl/xtensaelf.em, * emultempl/z80.em, * ld.h, * ldbuildid.c, * ldbuildid.h, * ldcref.c, * ldctor.c, * ldctor.h, * ldelf.c, * ldelf.h, * ldelfgen.c, * ldelfgen.h, * ldemul.c, * ldemul.h, * ldexp.c, * ldexp.h, * ldfile.c, * ldfile.h, * ldgram.y, * ldlang.c, * ldlang.h, * ldmain.c, * ldmain.h, * ldmisc.c, * ldmisc.h, * ldwrite.c, * lexsup.c, * mri.c, * pe-dll.c, * pe-dll.h, * pep-dll.h, * plugin.c, * plugin.h, * testplug.c, * testplug2.c, * testplug3.c, * testplug4.c: Replace bfd_boolean with bool, FALSE with false, and TRUE with true. * configure: Regenerate. --- ld/ldelf.c | 110 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'ld/ldelf.c') diff --git a/ld/ldelf.c b/ld/ldelf.c index 94d775d..631d11b 100644 --- a/ld/ldelf.c +++ b/ld/ldelf.c @@ -56,7 +56,7 @@ static struct bfd_link_needed_list *global_needed; static lang_input_statement_type *global_found; static struct stat global_stat; static struct bfd_link_needed_list *global_vercheck_needed; -static bfd_boolean global_vercheck_failed; +static bool global_vercheck_failed; void ldelf_after_parse (void) @@ -76,7 +76,7 @@ ldelf_after_parse (void) /* Handle the generation of DT_NEEDED tags. */ -bfd_boolean +bool ldelf_load_symbols (lang_input_statement_type *entry) { int link_class = 0; @@ -100,13 +100,13 @@ ldelf_load_symbols (lang_input_statement_type *entry) if (link_class == 0 || (bfd_get_file_flags (entry->the_bfd) & DYNAMIC) == 0) - return FALSE; + return false; bfd_elf_set_dyn_lib_class (entry->the_bfd, (enum dynamic_lib_link_class) link_class); /* Continue on with normal load_symbols processing. */ - return FALSE; + return false; } /* On Linux, it's possible to have different versions of the same @@ -168,7 +168,7 @@ ldelf_vercheck (lang_input_statement_type *s) FOO.SO.VER2, and VER1 and VER2 are different. This appears to be a version mismatch, so we tell the caller to try a different version of this library. */ - global_vercheck_failed = TRUE; + global_vercheck_failed = true; return; } } @@ -246,7 +246,7 @@ ldelf_stat_needed (lang_input_statement_type *s) named by a DT_NEEDED entry. The FORCE parameter indicates whether to skip the check for a conflicting version. */ -static bfd_boolean +static bool ldelf_try_needed (struct dt_needed *needed, int force, int is_linux) { bfd *abfd; @@ -259,7 +259,7 @@ ldelf_try_needed (struct dt_needed *needed, int force, int is_linux) { if (verbose) info_msg (_("attempt to open %s failed\n"), name); - return FALSE; + return false; } track_dependency_files (name); @@ -270,19 +270,19 @@ ldelf_try_needed (struct dt_needed *needed, int force, int is_linux) if (! bfd_check_format (abfd, bfd_object)) { bfd_close (abfd); - return FALSE; + return false; } if ((bfd_get_file_flags (abfd) & DYNAMIC) == 0) { bfd_close (abfd); - return FALSE; + return false; } /* For DT_NEEDED, they have to match. */ if (abfd->xvec != link_info.output_bfd->xvec) { bfd_close (abfd); - return FALSE; + return false; } /* Check whether this object would include any conflicting library @@ -300,14 +300,14 @@ ldelf_try_needed (struct dt_needed *needed, int force, int is_linux) if (needs != NULL) { global_vercheck_needed = needs; - global_vercheck_failed = FALSE; + global_vercheck_failed = false; lang_for_each_input_file (ldelf_vercheck); if (global_vercheck_failed) { bfd_close (abfd); /* Return FALSE to force the caller to move on to try another file on the search path. */ - return FALSE; + return false; } /* But wait! It gets much worse. On Linux, if a shared @@ -326,7 +326,7 @@ ldelf_try_needed (struct dt_needed *needed, int force, int is_linux) if (l == NULL) { bfd_close (abfd); - return FALSE; + return false; } } } @@ -357,7 +357,7 @@ ldelf_try_needed (struct dt_needed *needed, int force, int is_linux) { /* Return TRUE to indicate that we found the file, even though we aren't going to do anything with it. */ - return TRUE; + return true; } /* Specify the soname to use. */ @@ -384,12 +384,12 @@ ldelf_try_needed (struct dt_needed *needed, int force, int is_linux) if (! bfd_link_add_symbols (abfd, &link_info)) einfo (_("%F%P: %pB: error adding symbols: %E\n"), abfd); - return TRUE; + return true; } /* Search for a needed file in a path. */ -static bfd_boolean +static bool ldelf_search_needed (const char *path, struct dt_needed *n, int force, int is_linux, int elfsize) { @@ -402,7 +402,7 @@ ldelf_search_needed (const char *path, struct dt_needed *n, int force, return ldelf_try_needed (n, force, is_linux); if (path == NULL || *path == '\0') - return FALSE; + return false; needed.by = n->by; needed.name = n->name; @@ -586,7 +586,7 @@ ldelf_search_needed (const char *path, struct dt_needed *n, int force, needed.name = filename; if (ldelf_try_needed (&needed, force, is_linux)) - return TRUE; + return true; free (filename); @@ -595,7 +595,7 @@ ldelf_search_needed (const char *path, struct dt_needed *n, int force, path = s + 1; } - return FALSE; + return false; } /* Prefix the sysroot to absolute paths in PATH, a string containing @@ -687,11 +687,11 @@ ldelf_add_sysroot (const char *path) #include "elf-hints-local.h" #endif -static bfd_boolean +static bool ldelf_check_ld_elf_hints (const struct bfd_link_needed_list *l, int force, int elfsize) { - static bfd_boolean initialized; + static bool initialized; static const char *ld_elf_hints; struct dt_needed needed; @@ -726,15 +726,15 @@ ldelf_check_ld_elf_hints (const struct bfd_link_needed_list *l, int force, fclose (f); } - initialized = TRUE; + initialized = true; } if (ld_elf_hints == NULL) - return FALSE; + return false; needed.by = l->by; needed.name = l->name; - return ldelf_search_needed (ld_elf_hints, &needed, force, FALSE, elfsize); + return ldelf_search_needed (ld_elf_hints, &needed, force, false, elfsize); } /* For a native linker, check the file /etc/ld.so.conf for directories @@ -747,7 +747,7 @@ struct ldelf_ld_so_conf size_t len, alloc; }; -static bfd_boolean +static bool ldelf_parse_ld_so_conf (struct ldelf_ld_so_conf *, const char *); static void @@ -788,7 +788,7 @@ ldelf_parse_ld_so_conf_include (struct ldelf_ld_so_conf *info, free (newp); } -static bfd_boolean +static bool ldelf_parse_ld_so_conf (struct ldelf_ld_so_conf *info, const char *filename) { FILE *f = fopen (filename, FOPEN_RT); @@ -796,7 +796,7 @@ ldelf_parse_ld_so_conf (struct ldelf_ld_so_conf *info, const char *filename) size_t linelen; if (f == NULL) - return FALSE; + return false; linelen = 256; line = xmalloc (linelen); @@ -893,14 +893,14 @@ ldelf_parse_ld_so_conf (struct ldelf_ld_so_conf *info, const char *filename) while (! feof (f)); free (line); fclose (f); - return TRUE; + return true; } -static bfd_boolean +static bool ldelf_check_ld_so_conf (const struct bfd_link_needed_list *l, int force, int elfsize, const char *prefix) { - static bfd_boolean initialized; + static bool initialized; static const char *ld_so_conf; struct dt_needed needed; @@ -927,16 +927,16 @@ ldelf_check_ld_so_conf (const struct bfd_link_needed_list *l, int force, ld_so_conf = ldelf_add_sysroot (info.path); free (info.path); } - initialized = TRUE; + initialized = true; } if (ld_so_conf == NULL) - return FALSE; + return false; needed.by = l->by; needed.name = l->name; - return ldelf_search_needed (ld_so_conf, &needed, force, TRUE, elfsize); + return ldelf_search_needed (ld_so_conf, &needed, force, true, elfsize); } /* See if an input file matches a DT_NEEDED entry by name. */ @@ -1073,7 +1073,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, if (!link_info.traditional_format) { bfd *elfbfd = NULL; - bfd_boolean warn_eh_frame = FALSE; + bool warn_eh_frame = false; int seen_type = 0; for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next) @@ -1116,7 +1116,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) elfbfd = abfd; - warn_eh_frame = TRUE; + warn_eh_frame = true; } } @@ -1135,7 +1135,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, && bfd_set_section_alignment (s, 2)) { htab->eh_info.hdr_sec = s; - warn_eh_frame = FALSE; + warn_eh_frame = false; } } if (warn_eh_frame) @@ -1202,7 +1202,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, if (global_found != NULL) { nn.name = global_found->filename; - if (ldelf_try_needed (&nn, TRUE, is_linux)) + if (ldelf_try_needed (&nn, true, is_linux)) continue; } @@ -1347,7 +1347,7 @@ id_note_section_size (bfd *abfd ATTRIBUTE_UNUSED) return size; } -static bfd_boolean +static bool write_build_id (bfd *abfd) { const struct elf_backend_data *bed = get_elf_backend_data (abfd); @@ -1366,7 +1366,7 @@ write_build_id (bfd *abfd) { einfo (_("%P: warning: .note.gnu.build-id section discarded," " --build-id ignored\n")); - return TRUE; + return true; } i_shdr = &elf_section_data (asec->output_section)->this_hdr; @@ -1400,7 +1400,7 @@ write_build_id (bfd *abfd) /* Make .note.gnu.build-id section, and set up elf_tdata->build_id. */ -bfd_boolean +bool ldelf_setup_build_id (bfd *ibfd) { asection *s; @@ -1411,7 +1411,7 @@ ldelf_setup_build_id (bfd *ibfd) if (size == 0) { einfo (_("%P: warning: unrecognized --build-id style ignored\n")); - return FALSE; + return false; } flags = (SEC_ALLOC | SEC_LOAD | SEC_IN_MEMORY @@ -1425,12 +1425,12 @@ ldelf_setup_build_id (bfd *ibfd) t->o->build_id.sec = s; elf_section_type (s) = SHT_NOTE; s->size = size; - return TRUE; + return true; } einfo (_("%P: warning: cannot create .note.gnu.build-id section," " --build-id ignored\n")); - return FALSE; + return false; } /* Look through an expression for an assignment statement. */ @@ -1438,13 +1438,13 @@ ldelf_setup_build_id (bfd *ibfd) static void ldelf_find_exp_assignment (etree_type *exp) { - bfd_boolean provide = FALSE; + bool provide = false; switch (exp->type.node_class) { case etree_provide: case etree_provided: - provide = TRUE; + provide = true; /* Fallthru */ case etree_assign: /* We call record_link_assignment even if the symbol is defined. @@ -1564,7 +1564,7 @@ ldelf_before_allocation (char *audit, char *depaudit, { struct elf_link_hash_table *htab = elf_hash_table (&link_info); struct elf_link_hash_entry *h - = elf_link_hash_lookup (htab, "__ehdr_start", FALSE, FALSE, TRUE); + = elf_link_hash_lookup (htab, "__ehdr_start", false, false, true); /* Only adjust the export class if the symbol was referenced and not defined, otherwise leave it alone. */ @@ -1576,7 +1576,7 @@ ldelf_before_allocation (char *audit, char *depaudit, { const struct elf_backend_data *bed; bed = get_elf_backend_data (link_info.output_bfd); - (*bed->elf_backend_hide_symbol) (&link_info, h, TRUE); + (*bed->elf_backend_hide_symbol) (&link_info, h, true); if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL) h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN; /* Don't leave the symbol undefined. Undefined hidden @@ -1725,17 +1725,17 @@ ldelf_before_allocation (char *audit, char *depaudit, dynamic libraries have an extension of .so (or .sl on oddball systems like hpux). */ -bfd_boolean +bool ldelf_open_dynamic_archive (const char *arch, search_dirs_type *search, lang_input_statement_type *entry) { const char *filename; char *string; size_t len; - bfd_boolean opened = FALSE; + bool opened = false; if (! entry->flags.maybe_archive) - return FALSE; + return false; filename = entry->filename; len = strlen (search->name) + strlen (filename); @@ -1769,7 +1769,7 @@ ldelf_open_dynamic_archive (const char *arch, search_dirs_type *search, if (!opened && !ldfile_try_open_bfd (string, entry)) { free (string); - return FALSE; + return false; } entry->filename = string; @@ -1800,7 +1800,7 @@ ldelf_open_dynamic_archive (const char *arch, search_dirs_type *search, bfd_elf_set_dt_needed_name (entry->the_bfd, filename); } - return TRUE; + return true; } /* A variant of lang_output_section_find used by place_orphan. */ @@ -1869,7 +1869,7 @@ output_rel_find (int isdyn, int rela) /* Return whether IN is suitable to be part of OUT. */ -static bfd_boolean +static bool elf_orphan_compatible (asection *in, asection *out) { /* Non-zero sh_info implies a section with SHF_INFO_LINK with @@ -1880,7 +1880,7 @@ elf_orphan_compatible (asection *in, asection *out) shouldn't merge sections with differing unknown semantics. */ if (elf_section_data (out)->this_hdr.sh_info != elf_section_data (in)->this_hdr.sh_info) - return FALSE; + return false; /* We can't merge with a member of an output section group or merge two sections with differing SHF_EXCLUDE or other processor and OS specific flags when doing a relocatable link. */ @@ -1888,7 +1888,7 @@ elf_orphan_compatible (asection *in, asection *out) && (elf_next_in_group (out) != NULL || ((elf_section_flags (out) ^ elf_section_flags (in)) & (SHF_MASKPROC | SHF_MASKOS)) != 0)) - return FALSE; + return false; return _bfd_elf_match_sections_by_type (link_info.output_bfd, out, in->owner, in); } -- cgit v1.1