* ldexp.c: Likewise.
* ldfile.c: Likewise.
* ldlang.c: Likewise.
* ldmain.c: Likewise.
* lexsup.c: Likewise.
* pe-dll.c: Likewise.
+2002-05-03 Kazu Hirata <kazu@cs.umass.edu>
+
+ * ld.h: Fix formatting.
+ * ldexp.c: Likewise.
+ * ldfile.c: Likewise.
+ * ldlang.c: Likewise.
+ * ldmain.c: Likewise.
+ * lexsup.c: Likewise.
+ * pe-dll.c: Likewise.
+
2002-05-02 Alan Modra <amodra@bigpond.net.au>
* emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation):
/* ld.h -- general linker header file
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
/* 1 => assign space to common symbols even if `relocatable_output'. */
boolean force_common_definition;
- /* 1 => do not assign addresses to common symbols. */
+ /* 1 => do not assign addresses to common symbols. */
boolean inhibit_common_definition;
boolean relax;
{
if (config.map_file == NULL)
config.map_file = stderr;
-
+
if (tree == NULL)
{
minfo ("NULL TREE\n");
return;
}
-
+
switch (tree->type.node_class)
{
case etree_value:
/* Linker file opening and searching.
- Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001
+ Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
ldfile_input_filename = name;
lineno = 1;
-
+
saved_script_handle = ldlex_input_stack;
}
bfd_error_type err;
lang_statement_list_type *hold;
boolean bad_load = true;
-
+
err = bfd_get_error ();
/* See if the emulation has some special knowledge. */
einfo (_("%F%B: file not recognized: %E\n"), entry->the_bfd);
else
bad_load = false;
-
+
bfd_close (entry->the_bfd);
entry->the_bfd = NULL;
case bfd_archive:
if (entry->whole_archive)
{
- bfd * member = NULL;
+ bfd *member = NULL;
boolean loaded = true;
for (;;)
if (member == NULL)
break;
-
+
if (! bfd_check_format (member, bfd_object))
{
einfo (_("%F%B: member %B in archive is not an object\n"),
if (sec->spec.name != NULL && strcmp (sec->spec.name, "COMMON") == 0)
{
/* Remember the section that common is going to in case we
- later get something which doesn't know where to put it. */
+ later get something which doesn't know where to put it. */
default_common_section = output;
}
}
if ((region->current < region->origin
|| (region->current - region->origin > region->length))
&& ((region->current != region->origin + region->length)
- || base == 0))
+ || base == 0))
{
if (tree != (etree_type *) NULL)
- {
- einfo (_("%X%P: address 0x%v of %B section %s is not within region %s\n"),
- region->current,
- os->bfd_section->owner,
- os->bfd_section->name,
- region->name);
- }
+ {
+ einfo (_("%X%P: address 0x%v of %B section %s is not within region %s\n"),
+ region->current,
+ os->bfd_section->owner,
+ os->bfd_section->name,
+ region->name);
+ }
else
- {
- einfo (_("%X%P: region %s is full (%B section %s)\n"),
- region->name,
- os->bfd_section->owner,
- os->bfd_section->name);
- }
+ {
+ einfo (_("%X%P: region %s is full (%B section %s)\n"),
+ region->name,
+ os->bfd_section->owner,
+ os->bfd_section->name);
+ }
/* Reset the region pointer. */
region->current = region->origin;
}
if (value.valid_p == false)
einfo (_("%F%P: invalid data statement\n"));
}
- {
- unsigned int size;
+ {
+ unsigned int size;
switch (s->data_statement.type)
{
default:
h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true);
if (h != NULL && h->type == bfd_link_hash_undefined)
{
- unsigned opb;
+ unsigned opb;
- opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
+ opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
ldfile_output_machine);
h->type = bfd_link_hash_defined;
if (s->_cooked_size != 0)
else if (bfd_count_sections (input_bfd))
{
/* If the input bfd has no contents, it shouldn't set the
- private data of the output bfd. */
+ private data of the output bfd. */
bfd_error_handler_type pfn = NULL;
/* If no runtime region has been given, but the load region has
been, use the load region. */
if (strcmp (memspec, "*default*") == 0)
- current_section->region = lang_memory_region_lookup (lma_memspec);
+ current_section->region = lang_memory_region_lookup (lma_memspec);
}
current_section->phdrs = phdrs;
stat_ptr = &statement_list;
name = current_section->name;
lang_leave_output_section_statement (fill, "*default*",
- phdrs, "*default*");
+ phdrs, "*default*");
/* Define the magic symbols. */
const char *lma_memspec;
{
lang_memory_region_type *region;
- lang_memory_region_type * default_region;
+ lang_memory_region_type *default_region;
lang_memory_region_type *lma_region;
struct overlay_list *l;
struct lang_nocrossref *nocrossref;
bfd_size_type len;
if (sec == NULL)
- continue;
+ continue;
len = bfd_section_size (is->the_bfd, sec);
contents = xmalloc (len);
if (saved_script_handle == NULL)
{
int isfile;
- char *s = ldemul_get_script (& isfile);
+ char *s = ldemul_get_script (&isfile);
if (isfile)
ldfile_open_command_file (s);
else
- {
+ {
lex_string = s;
lex_redirect (s);
}
rewind (saved_script_handle);
while ((n = fread (buf, 1, ld_bufsz - 1, saved_script_handle)) > 0)
{
- buf [n] = 0;
+ buf[n] = 0;
info_msg (buf);
}
rewind (saved_script_handle);
{
int isfile;
- info_msg (ldemul_get_script (& isfile));
+ info_msg (ldemul_get_script (&isfile));
}
-
+
info_msg ("\n==================================================\n");
}
increment optind, and continue because getopt is too confused
and will seg-fault the next time around. */
einfo(_("%P%F: bad -rpath option\n"));
-
+
link_info.relocateable = true;
config.build_constructors = false;
config.magic_demand_paged = false;
break;
case OPTION_TARGET_HELP:
/* Mention any target specific options. */
- ldemul_list_emulation_options (stdout);
- exit (0);
+ ldemul_list_emulation_options (stdout);
+ exit (0);
case OPTION_TBSS:
set_section_start (".bss", optarg);
break;
version information. Read it, but don't assume that
we've seen a linker script. */
{
- FILE * hold_script_handle;
+ FILE *hold_script_handle;
hold_script_handle = saved_script_handle;
ldfile_open_command_file (optarg);
int two_dashes =
(ld_options[j].control == TWO_DASHES
|| ld_options[j].control == EXACTLY_TWO_DASHES);
-
+
printf ("%s-%s%s",
comma ? ", " : "",
two_dashes ? "-" : "",
at the end of this file. This function is not re-entrant and is
normally only called once, so static variables are used to reduce
the number of parameters and return values required.
-
+
See also: ld/emultempl/pe.em. */
/* Auto-import feature by Paul Sokolovsky
{ "dllcrt2.o", 9 },
{ "gcrt0.o", 7 },
{ "gcrt1.o", 7 },
- { "gcrt2.o", 7 },
+ { "gcrt2.o", 7 },
{ NULL, 0 }
};
exit (1);
}
-/* Helper functions for qsort. Relocs must be sorted so that we can write
+/* Helper functions for qsort. Relocs must be sorted so that we can write
them out by pages. */
typedef struct
if (abfd && (p = lbasename (abfd->filename)))
{
- afptr = autofilter_objlist;
- while (afptr->name)
+ afptr = autofilter_objlist;
+ while (afptr->name)
{
- if ( strcmp (p, afptr->name) == 0 )
- return 0;
+ if (strcmp (p, afptr->name) == 0)
+ return 0;
afptr++;
}
}
if (strcmp (n, afptr->name) == 0)
return 0;
- afptr ++;
+ afptr++;
}
/* Next, exclude symbols starting with ... */
if (strncmp (n, afptr->name, afptr->len) == 0)
return 0;
- afptr ++;
+ afptr++;
}
/* Finally, exclude symbols ending with ... */
afptr = autofilter_symbolsuffixlist;
while (afptr->name)
{
- if ((len >= afptr->len) &&
+ if ((len >= afptr->len)
/* Add 1 to insure match with trailing '\0'. */
- strncmp (n + len - afptr->len, afptr->name,
- afptr->len + 1) == 0)
+ && strncmp (n + len - afptr->len, afptr->name,
+ afptr->len + 1) == 0)
return 0;
- afptr ++;
+ afptr++;
}
}
sprintf (name, "%s%s", U("_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)
+ if (blhe && blhe->type == bfd_link_hash_defined)
continue;
}
if (pe_def_file->exports[i].ordinal == -1)
{
while (exported_symbols[next_ordinal - min_ordinal] != -1)
- next_ordinal ++;
+ next_ordinal++;
exported_symbols[next_ordinal - min_ordinal] = i;
pe_def_file->exports[i].ordinal = next_ordinal;
for (i = 0; i < nrelocs; i++)
{
if (pe_dll_extra_pe_debug)
- {
+ {
struct symbol_cache_entry *sym = *relocs[i]->sym_ptr_ptr;
- printf("rel: %s\n",sym->name);
+ printf ("rel: %s\n", sym->name);
}
if (!relocs[i]->howto->pc_relative
&& relocs[i]->howto->type != pe_details->imagebase_reloc)
if (reloc_data[i].type == 4)
reloc_sz += 2;
}
-
+
reloc_sz = (reloc_sz + 3) & ~3; /* 4-byte align. */
reloc_d = (unsigned char *) xmalloc (reloc_sz);
sec_page = (unsigned long) (-1);
.long 0
.rva __my_dll_iname
.rva fthunk
-
+
.section .idata$5
.long 0
fthunk:
-
+
.section .idata$4
.long 0
hname: */
.global __imp__function
_function:
jmp *__imp__function:
-
+
.section idata$7
.long __head_my_dll
-
+
.section .idata$5
___imp_function:
__imp__function:
static int counter;
static char *fixup_name = NULL;
static size_t buffer_len = 0;
-
+
struct symbol_cache_entry *sym = *rel->sym_ptr_ptr;
-
+
bfd *abfd = bfd_asymbol_bfd (sym);
struct coff_link_hash_entry *myh = NULL;
}
if (strlen (sym->name) + 25 > buffer_len)
- /* Assume 25 chars for "__fu" + counter + "_". If counter is
+ /* Assume 25 chars for "__fu" + counter + "_". If counter is
bigger than 20 digits long, we've got worse problems than
overflowing this buffer... */
{
buffer_len = ((strlen (sym->name) + 25) + 127) & ~127;
fixup_name = (char *) xmalloc (buffer_len);
}
-
+
sprintf (fixup_name, "__fu%d_%s", counter++, sym->name);
- bfd_coff_link_add_one_symbol (&link_info, abfd, fixup_name, BSF_GLOBAL,
+ bfd_coff_link_add_one_symbol (&link_info, abfd, fixup_name, BSF_GLOBAL,
current_sec, /* sym->section, */
rel->address, NULL, true, false,
(struct bfd_link_hash_entry **) &myh);
#if 0
- printf ("type:%d\n", myh->type);
- printf ("%s\n", myh->root.u.def.section->name);
+ printf ("type:%d\n", myh->type);
+ printf ("%s\n", myh->root.u.def.section->name);
#endif
return fixup_name;
}
.rva __fuNN_SYM (pointer to reference (address) in text) */
static bfd *
-make_import_fixup_entry (name, fixup_name, dll_symname,parent)
+make_import_fixup_entry (name, fixup_name, dll_symname, parent)
const char *name;
const char *fixup_name;
const char *dll_symname;
symtab = (asymbol **) xmalloc (6 * sizeof (asymbol *));
id3 = quick_section (abfd, ".idata$3", SEC_HAS_CONTENTS, 2);
-#if 0
- quick_symbol (abfd, U ("_head_"), dll_symname, "", id2, BSF_GLOBAL, 0);
+#if 0
+ quick_symbol (abfd, U ("_head_"), dll_symname, "", id2, BSF_GLOBAL, 0);
#endif
quick_symbol (abfd, U ("_nm_thnk_"), name, "", UNDSEC, BSF_GLOBAL, 0);
quick_symbol (abfd, U (""), dll_symname, "_iname", UNDSEC, BSF_GLOBAL, 0);