summaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-03-31 10:39:51 +1030
committerAlan Modra <amodra@gmail.com>2021-03-31 10:49:23 +1030
commitf38a2680c2f04db6eac4fd87380cd3cf7bcb3bcc (patch)
tree38d5b486b39b163f1581abf67889d191a8e5cc9f /ld/pe-dll.c
parent015dc7e1f8a971692a910e6cfc64faf9216e75c3 (diff)
downloadbinutils-gdb-f38a2680c2f04db6eac4fd87380cd3cf7bcb3bcc.tar.gz
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.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c116
1 files changed, 58 insertions, 58 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index 56b4375d8ce..cdb343bb98b 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -170,7 +170,7 @@ static struct bfd_section *edata_s, *reloc_s;
static unsigned char *edata_d, *reloc_d;
static size_t edata_sz, reloc_sz;
static int runtime_pseudo_relocs_created = 0;
-static bfd_boolean runtime_pseudp_reloc_v2_init = FALSE;
+static bool runtime_pseudp_reloc_v2_init = false;
typedef struct
{
@@ -186,7 +186,7 @@ typedef struct
unsigned int imagebase_reloc;
int pe_arch;
int bfd_arch;
- bfd_boolean underscored;
+ bool underscored;
const autofilter_entry_type* autofilter_symbollist;
}
pe_details_type;
@@ -264,9 +264,9 @@ static pe_details_type pe_detail_list[] =
PE_ARCH_i386,
bfd_arch_i386,
#ifdef pe_use_x86_64
- FALSE,
+ false,
#else
- TRUE,
+ true,
#endif
autofilter_symbollist_i386
},
@@ -277,7 +277,7 @@ static pe_details_type pe_detail_list[] =
3 /* R_IMAGEBASE */,
PE_ARCH_i386,
bfd_arch_i386,
- FALSE,
+ false,
autofilter_symbollist_i386
},
#else
@@ -287,7 +287,7 @@ static pe_details_type pe_detail_list[] =
7 /* R_IMAGEBASE */,
PE_ARCH_i386,
bfd_arch_i386,
- TRUE,
+ true,
autofilter_symbollist_i386
},
#endif
@@ -297,7 +297,7 @@ static pe_details_type pe_detail_list[] =
16 /* R_SH_IMAGEBASE */,
PE_ARCH_sh,
bfd_arch_sh,
- TRUE,
+ true,
autofilter_symbollist_generic
},
{
@@ -306,7 +306,7 @@ static pe_details_type pe_detail_list[] =
34 /* MIPS_R_RVA */,
PE_ARCH_mips,
bfd_arch_mips,
- FALSE,
+ false,
autofilter_symbollist_generic
},
{
@@ -315,7 +315,7 @@ static pe_details_type pe_detail_list[] =
11 /* ARM_RVA32 */,
PE_ARCH_arm,
bfd_arch_arm,
- TRUE,
+ true,
autofilter_symbollist_generic
},
{
@@ -324,10 +324,10 @@ static pe_details_type pe_detail_list[] =
2, /* ARM_RVA32 on Windows CE, see bfd/coff-arm.c. */
PE_ARCH_arm_wince,
bfd_arch_arm,
- FALSE,
+ false,
autofilter_symbollist_generic
},
- { NULL, NULL, 0, 0, 0, FALSE, NULL }
+ { NULL, NULL, 0, 0, 0, false, NULL }
};
static const pe_details_type *pe_details;
@@ -542,7 +542,7 @@ pe_dll_add_excludes (const char *new_excludes, const exclude_type type)
free (local_copy);
}
-static bfd_boolean
+static bool
is_import (const char* n)
{
return (startswith (n, "__imp_"));
@@ -674,7 +674,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
bfd *b;
struct bfd_section *s;
def_file_export *e = 0;
- bfd_boolean resort_needed;
+ bool resort_needed;
if (!pe_def_file)
pe_def_file = def_file_empty ();
@@ -707,7 +707,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
{
struct coff_link_hash_entry *sym_hash;
sym_hash = coff_link_hash_lookup (coff_hash_table (info),
- ac->symbol_name, FALSE, FALSE, FALSE);
+ ac->symbol_name, false, false, false);
if (sym_hash && sym_hash->root.type == bfd_link_hash_common
&& sym_hash->root.u.c.p->alignment_power < (unsigned) ac->alignment)
{
@@ -746,7 +746,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
/* We should export symbols which are either global or not
anything at all. (.bss data is the latter)
We should not export undefined symbols. */
- bfd_boolean would_export
+ bool would_export
= (symbols[j]->section != bfd_und_section_ptr
&& ((symbols[j]->flags & BSF_GLOBAL)
|| (symbols[j]->flags == 0)));
@@ -768,7 +768,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
sprintf (name, "%s%s", "__imp_", sn);
blhe = bfd_link_hash_lookup (info->hash, name,
- FALSE, FALSE, FALSE);
+ false, false, false);
free (name);
if (blhe && blhe->type == bfd_link_hash_defined)
@@ -801,7 +801,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
if (NE == 0)
return;
- resort_needed = FALSE;
+ resort_needed = false;
/* Canonicalize the export list. */
if (pe_dll_kill_ats)
@@ -826,7 +826,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
einfo (_("%X%P: cannot export %s: invalid export name\n"),
pe_def_file->exports[i].name);
pe_def_file->exports[i].name = tmp;
- resort_needed = TRUE;
+ resort_needed = true;
}
}
}
@@ -937,7 +937,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
blhe = bfd_link_hash_lookup (info->hash,
name,
- FALSE, FALSE, TRUE);
+ false, false, true);
if (blhe
&& (blhe->type == bfd_link_hash_defined
@@ -1186,7 +1186,7 @@ fill_exported_offsets (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
blhe = bfd_link_hash_lookup (info->hash,
name,
- FALSE, FALSE, TRUE);
+ false, false, true);
if (blhe && blhe->type == bfd_link_hash_defined)
exported_symbol_offsets[i] = blhe->u.def.value;
@@ -1342,7 +1342,7 @@ pe_walk_relocs (struct bfd_link_info *info,
/* Warning: the callback needs to be passed NAME directly. */
if (import_hash)
{
- if (bfd_hash_lookup (import_hash, sym->name, FALSE, FALSE))
+ if (bfd_hash_lookup (import_hash, sym->name, false, false))
{
strcpy (name, sym->name);
cb (relocs[i], s, name, symname);
@@ -1423,7 +1423,7 @@ pe_find_data_imports (const char *symhead,
if (sym && sym->type == bfd_link_hash_defined)
{
if (import_hash)
- bfd_hash_lookup (import_hash, undef->root.string, TRUE, FALSE);
+ bfd_hash_lookup (import_hash, undef->root.string, true, false);
else
{
bfd *b = sym->u.def.section->owner;
@@ -1471,7 +1471,7 @@ pe_find_data_imports (const char *symhead,
if (link_info.pei386_auto_import == -1)
{
- static bfd_boolean warned = FALSE;
+ static bool warned = false;
info_msg (_("Info: resolving %s by linking to %s "
"(auto-import)\n"), name, impname);
@@ -1484,7 +1484,7 @@ pe_find_data_imports (const char *symhead,
"command line; this should work unless it "
"involves constant data structures referencing "
"symbols from auto-imported DLLs\n"));
- warned = TRUE;
+ warned = true;
}
}
}
@@ -1581,7 +1581,7 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
struct bfd_symbol *sym = *relocs[i]->sym_ptr_ptr;
const struct bfd_link_hash_entry *blhe
= bfd_wrapped_link_hash_lookup (abfd, info, sym->name,
- FALSE, FALSE, FALSE);
+ false, false, false);
/* Don't create relocs for undefined weak symbols. */
if (sym->flags == BSF_WEAK)
@@ -2271,7 +2271,7 @@ static const unsigned char jmp_arm_bytes[] =
static bfd *
-make_one (def_file_export *exp, bfd *parent, bfd_boolean include_jmp_stub)
+make_one (def_file_export *exp, bfd *parent, bool include_jmp_stub)
{
asection *tx, *id7, *id5, *id4, *id6;
unsigned char *td = NULL, *d7, *d5, *d4, *d6 = NULL;
@@ -2552,7 +2552,7 @@ make_import_fixup_mark (arelent *rel, char *name)
bh = NULL;
bfd_coff_link_add_one_symbol (&link_info, abfd, fixup_name, BSF_GLOBAL,
current_sec, /* sym->section, */
- rel->address, NULL, TRUE, FALSE, &bh);
+ rel->address, NULL, true, false, &bh);
return bh->root.string;
}
@@ -2664,7 +2664,7 @@ make_runtime_pseudo_reloc (const char *name ATTRIBUTE_UNUSED,
if (!runtime_pseudp_reloc_v2_init)
{
size += 12;
- runtime_pseudp_reloc_v2_init = TRUE;
+ runtime_pseudp_reloc_v2_init = true;
}
quick_symbol (abfd, "__imp_", name, "", UNDSEC, BSF_GLOBAL, 0);
@@ -2774,7 +2774,7 @@ pe_create_import_fixup (arelent *rel, asection *s, bfd_vma addend, char *name,
add_bfd_to_link (b, bfd_get_filename (b), &link_info);
/* If we ever use autoimport, we have to cast text section writable. */
- config.text_read_only = FALSE;
+ config.text_read_only = false;
link_info.output_bfd->flags &= ~WP_TEXT;
}
@@ -2926,7 +2926,7 @@ pe_dll_generate_implib (def_file *def, const char *impfilename, struct bfd_link_
struct coff_link_hash_entry *h;
h = coff_link_hash_lookup (coff_hash_table (info), internal,
- FALSE, FALSE, FALSE);
+ false, false, false);
if (h != NULL
/* If the symbol is hidden and undefined then it
has been swept up by garbage collection. */
@@ -2943,7 +2943,7 @@ pe_dll_generate_implib (def_file *def, const char *impfilename, struct bfd_link_
sprintf (name, "_%s", internal);
h = coff_link_hash_lookup (coff_hash_table (info), name,
- FALSE, FALSE, FALSE);
+ false, false, false);
free (name);
if (h != NULL
@@ -3024,7 +3024,7 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
if (kv)
{
- h = bfd_link_hash_lookup (linfo->hash, kv->oname, FALSE, FALSE, FALSE);
+ h = bfd_link_hash_lookup (linfo->hash, kv->oname, false, false, false);
if (h->type == bfd_link_hash_undefined)
goto return_h;
}
@@ -3047,7 +3047,7 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
sizeof (struct key_value), undef_sort_cmp);
if (kv)
{
- h = bfd_link_hash_lookup (linfo->hash, kv->oname, FALSE, FALSE, FALSE);
+ h = bfd_link_hash_lookup (linfo->hash, kv->oname, false, false, false);
if (h->type == bfd_link_hash_undefined)
goto return_h;
}
@@ -3059,7 +3059,7 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
sizeof (struct key_value), undef_sort_cmp);
if (kv)
{
- h = bfd_link_hash_lookup (linfo->hash, kv->oname, FALSE, FALSE, FALSE);
+ h = bfd_link_hash_lookup (linfo->hash, kv->oname, false, false, false);
if (h->type == bfd_link_hash_undefined)
goto return_h;
}
@@ -3073,7 +3073,7 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
if (kv)
{
- h = bfd_link_hash_lookup (linfo->hash, kv->oname, FALSE, FALSE, FALSE);
+ h = bfd_link_hash_lookup (linfo->hash, kv->oname, false, false, false);
if (h->type == bfd_link_hash_undefined)
goto return_h;
}
@@ -3092,7 +3092,7 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
if (kv)
{
- h = bfd_link_hash_lookup (linfo->hash, kv->oname, FALSE, FALSE, FALSE);
+ h = bfd_link_hash_lookup (linfo->hash, kv->oname, false, false, false);
if (h->type == bfd_link_hash_undefined)
goto return_h;
}
@@ -3104,16 +3104,16 @@ pe_find_cdecl_alias_match (struct bfd_link_info *linfo, char *name)
return h;
}
-static bfd_boolean
+static bool
pe_undef_count (struct bfd_link_hash_entry *h ATTRIBUTE_UNUSED,
void *inf ATTRIBUTE_UNUSED)
{
if (h->type == bfd_link_hash_undefined)
undef_count++;
- return TRUE;
+ return true;
}
-static bfd_boolean
+static bool
pe_undef_fill (struct bfd_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
{
if (h->type == bfd_link_hash_undefined)
@@ -3128,7 +3128,7 @@ pe_undef_fill (struct bfd_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
udef_table[undef_count].oname = h->root.string;
undef_count++;
}
- return TRUE;
+ return true;
}
static void
@@ -3204,12 +3204,12 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *linfo)
/* See if we need this import. */
size_t len = strlen (imp[i].internal_name);
char *name = xmalloc (len + 2 + 6);
- bfd_boolean include_jmp_stub = FALSE;
- bfd_boolean is_cdecl = FALSE;
- bfd_boolean is_undef = FALSE;
+ bool include_jmp_stub = false;
+ bool is_cdecl = false;
+ bool is_undef = false;
if (!lead_at && strchr (imp[i].internal_name, '@') == NULL)
- is_cdecl = TRUE;
+ is_cdecl = true;
if (lead_at)
sprintf (name, "%s", imp[i].internal_name);
@@ -3217,7 +3217,7 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *linfo)
sprintf (name, "%s%s",U (""), imp[i].internal_name);
blhe = bfd_link_hash_lookup (linfo->hash, name,
- FALSE, FALSE, FALSE);
+ false, false, false);
/* Include the jump stub for <sym> only if the <sym>
is undefined. */
@@ -3230,13 +3230,13 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *linfo)
imp[i].internal_name);
blhe = bfd_link_hash_lookup (linfo->hash, name,
- FALSE, FALSE, FALSE);
+ false, false, false);
if (blhe)
is_undef = (blhe->type == bfd_link_hash_undefined);
}
else
{
- include_jmp_stub = TRUE;
+ include_jmp_stub = true;
is_undef = (blhe->type == bfd_link_hash_undefined);
}
@@ -3244,7 +3244,7 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *linfo)
{
sprintf (name, "%s%s",U (""), imp[i].internal_name);
blhe = pe_find_cdecl_alias_match (linfo, name);
- include_jmp_stub = TRUE;
+ include_jmp_stub = true;
if (blhe)
is_undef = (blhe->type == bfd_link_hash_undefined);
}
@@ -3323,7 +3323,7 @@ pe_as32 (void *ptr)
return b[0] + (b[1] << 8) + (b[2] << 16) + ((unsigned) b[3] << 24);
}
-bfd_boolean
+bool
pe_implied_import_dll (const char *filename)
{
bfd *dll;
@@ -3350,7 +3350,7 @@ pe_implied_import_dll (const char *filename)
if (!dll)
{
einfo (_("%X%P: open %s: %E\n"), filename);
- return FALSE;
+ return false;
}
track_dependency_files (filename);
@@ -3359,7 +3359,7 @@ pe_implied_import_dll (const char *filename)
if (!bfd_check_format (dll, bfd_object))
{
einfo (_("%X%P: %s: this doesn't appear to be a DLL\n"), filename);
- return FALSE;
+ return false;
}
/* Get pe_header, optional header and numbers of directory entries. */
@@ -3373,7 +3373,7 @@ pe_implied_import_dll (const char *filename)
/* No import or export directory entry. */
if (num_entries < 1)
- return FALSE;
+ return false;
#ifdef pe_use_x86_64
export_rva = pe_get32 (dll, opthdr_ofs + 96 + 4 * 4);
@@ -3385,7 +3385,7 @@ pe_implied_import_dll (const char *filename)
/* No export table - nothing to export. */
if (export_size == 0)
- return FALSE;
+ return false;
nsections = pe_get16 (dll, pe_header_offset + 4 + 2);
secptr = (pe_header_offset + 4 + 20 +
@@ -3482,7 +3482,7 @@ pe_implied_import_dll (const char *filename)
{
if (pe_dll_extra_pe_debug)
printf ("%s is already loaded\n", dllname);
- return TRUE;
+ return true;
}
/* This is an optimized version of the insertion loop, which avoids lots of
@@ -3516,7 +3516,7 @@ pe_implied_import_dll (const char *filename)
(unsigned long) func_rva, is_data ? "(data)" : "");
}
- return TRUE;
+ return true;
}
/* Iterate through the list of symbols. */
@@ -3554,7 +3554,7 @@ pe_implied_import_dll (const char *filename)
}
}
- return TRUE;
+ return true;
}
void
@@ -3631,7 +3631,7 @@ pe_exe_fill_sections (bfd *abfd, struct bfd_link_info *info)
/* Resize the sections. */
lang_reset_memory_regions ();
- lang_size_sections (NULL, TRUE);
+ lang_size_sections (NULL, true);
/* Redo special stuff. */
ldemul_after_allocation ();
@@ -3643,7 +3643,7 @@ pe_exe_fill_sections (bfd *abfd, struct bfd_link_info *info)
reloc_s->contents = reloc_d;
}
-bfd_boolean
+bool
pe_bfd_is_dll (bfd *abfd)
{
return (bfd_get_format (abfd) == bfd_object