BFD: Catch & report unhandled PE section flags.

LD: Catch BFD errors whilst loading symbols and do not produce an executable.
This commit is contained in:
Nick Clifton 2001-02-27 01:38:06 +00:00
parent fa7cd6d20a
commit 1276aefac0
7 changed files with 790 additions and 643 deletions

View File

@ -1,3 +1,15 @@
2001-02-26 Nick Clifton <nickc@redhat.com>
* coffcode.h (styp_to_sec_flags) [COFF_WITH_PE version]: Tidy
up, replacing multiple if statements with a switch.
(handle_COMDAT): New function.
2001-02-26 H.J. Lu <hjl@gnu.org>
* coffcode.h (styp_to_sec_flags) [COFF_WITH_PE version]: Issue
a warning for section flags we do not handle instead of
aborting.
2001-02-26 Andreas Jaeger <aj@suse.de>
* elf64-x86-64.c (x86_64_elf_howto_table): Fix order of entries.

View File

@ -339,6 +339,9 @@ static long coff_canonicalize_reloc
#ifndef coff_mkobject_hook
static PTR coff_mkobject_hook PARAMS ((bfd *, PTR, PTR));
#endif
#ifdef COFF_WITH_PE
static flagword handle_COMDAT PARAMS ((bfd *, flagword, PTR, const char *, asection *));
#endif
/* void warning(); */
@ -698,6 +701,261 @@ styp_to_sec_flags (abfd, hdr, name, section)
#else /* COFF_WITH_PE */
static flagword
handle_COMDAT (abfd, sec_flags, hdr, name, section)
bfd * abfd;
flagword sec_flags;
PTR hdr;
const char *name;
asection *section;
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
bfd_byte *esymstart, *esym, *esymend;
int seen_state = 0;
char *target_name = NULL;
sec_flags |= SEC_LINK_ONCE;
/* Unfortunately, the PE format stores essential information in
the symbol table, of all places. We need to extract that
information now, so that objdump and the linker will know how
to handle the section without worrying about the symbols. We
can't call slurp_symtab, because the linker doesn't want the
swapped symbols. */
/* COMDAT sections are special. The first symbol is the section
symbol, which tells what kind of COMDAT section it is. The
second symbol is the "comdat symbol" - the one with the
unique name. GNU uses the section symbol for the unique
name; MS uses ".text" for every comdat section. Sigh. - DJ */
/* This is not mirrored in sec_to_styp_flags(), but there
doesn't seem to be a need to, either, and it would at best be
rather messy. */
if (! _bfd_coff_get_external_symbols (abfd))
return sec_flags;
esymstart = esym = (bfd_byte *) obj_coff_external_syms (abfd);
esymend = esym + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd);
while (esym < esymend)
{
struct internal_syment isym;
char buf[SYMNMLEN + 1];
const char *symname;
bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &isym);
if (sizeof (internal_s->s_name) > SYMNMLEN)
{
/* This case implies that the matching
symbol name will be in the string table. */
abort ();
}
if (isym.n_scnum == section->target_index)
{
/* According to the MSVC documentation, the first
TWO entries with the section # are both of
interest to us. The first one is the "section
symbol" (section name). The second is the comdat
symbol name. Here, we've found the first
qualifying entry; we distinguish it from the
second with a state flag.
In the case of gas-generated (at least until that
is fixed) .o files, it isn't necessarily the
second one. It may be some other later symbol.
Since gas also doesn't follow MS conventions and
emits the section similar to .text$<name>, where
<something> is the name we're looking for, we
distinguish the two as follows:
If the section name is simply a section name (no
$) we presume it's MS-generated, and look at
precisely the second symbol for the comdat name.
If the section name has a $, we assume it's
gas-generated, and look for <something> (whatever
follows the $) as the comdat symbol. */
/* All 3 branches use this */
symname = _bfd_coff_internal_syment_name (abfd, &isym, buf);
if (symname == NULL)
abort ();
switch (seen_state)
{
case 0:
{
/* The first time we've seen the symbol. */
union internal_auxent aux;
seen_state = 1;
/* If it isn't the stuff we're expecting, die;
The MS documentation is vague, but it
appears that the second entry serves BOTH
as the comdat symbol and the defining
symbol record (either C_STAT or C_EXT,
possibly with an aux entry with debug
information if it's a function.) It
appears the only way to find the second one
is to count. (On Intel, they appear to be
adjacent, but on Alpha, they have been
found separated.)
Here, we think we've found the first one,
but there's some checking we can do to be
sure. */
if (! (isym.n_sclass == C_STAT
&& isym.n_type == T_NULL
&& isym.n_value == 0))
abort ();
/* FIXME LATER: MSVC generates section names
like .text for comdats. Gas generates
names like .text$foo__Fv (in the case of a
function). See comment above for more. */
if (strcmp (name, symname) != 0)
abort ();
/* This is the section symbol. */
bfd_coff_swap_aux_in (abfd, (PTR) (esym + bfd_coff_symesz (abfd)),
isym.n_type, isym.n_sclass,
0, isym.n_numaux, (PTR) &aux);
target_name = strchr (name, '$');
if (target_name != NULL)
{
/* Gas mode. */
seen_state = 2;
/* Skip the `$'. */
target_name += 1;
}
/* FIXME: Microsoft uses NODUPLICATES and
ASSOCIATIVE, but gnu uses ANY and
SAME_SIZE. Unfortunately, gnu doesn't do
the comdat symbols right. So, until we can
fix it to do the right thing, we are
temporarily disabling comdats for the MS
types (they're used in DLLs and C++, but we
don't support *their* C++ libraries anyway
- DJ. */
/* Cygwin does not follow the MS style, and
uses ANY and SAME_SIZE where NODUPLICATES
and ASSOCIATIVE should be used. For
Interix, we just do the right thing up
front. */
switch (aux.x_scn.x_comdat)
{
case IMAGE_COMDAT_SELECT_NODUPLICATES:
#ifdef STRICT_PE_FORMAT
sec_flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
#else
sec_flags &= ~SEC_LINK_ONCE;
#endif
break;
case IMAGE_COMDAT_SELECT_ANY:
sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
break;
case IMAGE_COMDAT_SELECT_SAME_SIZE:
sec_flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
break;
case IMAGE_COMDAT_SELECT_EXACT_MATCH:
/* Not yet fully implemented ??? */
sec_flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
break;
/* debug$S gets this case; other
implications ??? */
/* There may be no symbol... we'll search
the whole table... Is this the right
place to play this game? Or should we do
it when reading it in. */
case IMAGE_COMDAT_SELECT_ASSOCIATIVE:
#ifdef STRICT_PE_FORMAT
/* FIXME: This is not currently implemented. */
sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
#else
sec_flags &= ~SEC_LINK_ONCE;
#endif
break;
default: /* 0 means "no symbol" */
/* debug$F gets this case; other
implications ??? */
sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
break;
}
}
break;
case 2:
/* Gas mode: the first matching on partial name. */
#ifndef TARGET_UNDERSCORE
#define TARGET_UNDERSCORE 0
#endif
/* Is this the name we're looking for? */
if (strcmp (target_name,
symname + (TARGET_UNDERSCORE ? 1 : 0)) != 0)
{
/* Not the name we're looking for */
esym += (isym.n_numaux + 1) * bfd_coff_symesz (abfd);
continue;
}
/* Fall through. */
case 1:
/* MSVC mode: the lexically second symbol (or
drop through from the above). */
{
char *newname;
/* This must the the second symbol with the
section #. It is the actual symbol name.
Intel puts the two adjacent, but Alpha (at
least) spreads them out. */
section->comdat =
bfd_alloc (abfd, sizeof (struct bfd_comdat_info));
if (section->comdat == NULL)
abort ();
section->comdat->symbol =
(esym - esymstart) / bfd_coff_symesz (abfd);
newname = bfd_alloc (abfd, strlen (symname) + 1);
if (newname == NULL)
abort ();
strcpy (newname, symname);
section->comdat->name = newname;
}
goto breakloop;
}
}
esym += (isym.n_numaux + 1) * bfd_coff_symesz (abfd);
}
breakloop:
return sec_flags;
}
/* The PE version; see above for the general comments.
Since to set the SEC_LINK_ONCE and associated flags, we have to
@ -709,318 +967,116 @@ styp_to_sec_flags (abfd, hdr, name, section)
static flagword
styp_to_sec_flags (abfd, hdr, name, section)
bfd *abfd ATTRIBUTE_UNUSED;
bfd *abfd;
PTR hdr;
const char *name;
asection *section;
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
long styp_flags = internal_s->s_flags;
flagword sec_flags = 0;
flagword sec_flags;
if (styp_flags & STYP_DSECT)
abort (); /* Don't know what to do */
#ifdef SEC_NEVER_LOAD
if (styp_flags & STYP_NOLOAD)
sec_flags |= SEC_NEVER_LOAD;
#endif
if (styp_flags & STYP_GROUP)
abort (); /* Don't know what to do */
/* skip IMAGE_SCN_TYPE_NO_PAD */
if (styp_flags & STYP_COPY)
abort (); /* Don't know what to do */
if (styp_flags & IMAGE_SCN_CNT_CODE)
sec_flags |= SEC_CODE | SEC_ALLOC | SEC_LOAD;
if (styp_flags & IMAGE_SCN_CNT_INITIALIZED_DATA)
sec_flags |= SEC_DATA | SEC_ALLOC | SEC_LOAD;
if (styp_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA)
sec_flags |= SEC_ALLOC;
if (styp_flags & IMAGE_SCN_LNK_OTHER)
abort (); /* Don't know what to do */
if (styp_flags & IMAGE_SCN_LNK_INFO)
/* Assume read only unless IMAGE_SCN_MEM_WRITE is specified. */
sec_flags = SEC_READONLY;
/* Process each flag bit in styp_flags in turn. */
while (styp_flags)
{
/* We mark these as SEC_DEBUGGING, but only if COFF_PAGE_SIZE is
defined. coff_compute_section_file_positions uses
COFF_PAGE_SIZE to ensure that the low order bits of the
section VMA and the file offset match. If we don't know
COFF_PAGE_SIZE, we can't ensure the correct correspondence,
and demand page loading of the file will fail. */
#ifdef COFF_PAGE_SIZE
sec_flags |= SEC_DEBUGGING;
#endif
}
if (styp_flags & STYP_OVER)
abort (); /* Don't know what to do */
if (styp_flags & IMAGE_SCN_LNK_REMOVE)
sec_flags |= SEC_EXCLUDE;
long flag = styp_flags & - styp_flags;
char * unhandled = NULL;
styp_flags &= ~ flag;
if (styp_flags & IMAGE_SCN_MEM_SHARED)
sec_flags |= SEC_SHARED;
/* COMDAT: see below */
if (styp_flags & IMAGE_SCN_MEM_DISCARDABLE)
sec_flags |= SEC_DEBUGGING;
if (styp_flags & IMAGE_SCN_MEM_NOT_CACHED)
abort ();/* Don't know what to do */
if (styp_flags & IMAGE_SCN_MEM_NOT_PAGED)
abort (); /* Don't know what to do */
/* We infer from the distinct read/write/execute bits the settings
of some of the bfd flags; the actual values, should we need them,
are also in pei_section_data (abfd, section)->pe_flags. */
/* We infer from the distinct read/write/execute bits the settings
of some of the bfd flags; the actual values, should we need them,
are also in pei_section_data (abfd, section)->pe_flags. */
if (styp_flags & IMAGE_SCN_MEM_EXECUTE)
sec_flags |= SEC_CODE; /* Probably redundant */
/* IMAGE_SCN_MEM_READ is simply ignored, assuming it always to be true. */
if ((styp_flags & IMAGE_SCN_MEM_WRITE) == 0)
sec_flags |= SEC_READONLY;
/* COMDAT gets very special treatment. */
if (styp_flags & IMAGE_SCN_LNK_COMDAT)
{
sec_flags |= SEC_LINK_ONCE;
/* Unfortunately, the PE format stores essential information in
the symbol table, of all places. We need to extract that
information now, so that objdump and the linker will know how
to handle the section without worrying about the symbols. We
can't call slurp_symtab, because the linker doesn't want the
swapped symbols. */
/* COMDAT sections are special. The first symbol is the section
symbol, which tells what kind of COMDAT section it is. The
second symbol is the "comdat symbol" - the one with the
unique name. GNU uses the section symbol for the unique
name; MS uses ".text" for every comdat section. Sigh. - DJ */
/* This is not mirrored in sec_to_styp_flags(), but there
doesn't seem to be a need to, either, and it would at best be
rather messy. */
if (_bfd_coff_get_external_symbols (abfd))
switch (flag)
{
bfd_byte *esymstart, *esym, *esymend;
int seen_state = 0;
char *target_name = NULL;
esymstart = esym = (bfd_byte *) obj_coff_external_syms (abfd);
esymend = esym + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd);
while (esym < esymend)
{
struct internal_syment isym;
char buf[SYMNMLEN + 1];
const char *symname;
bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &isym);
if (sizeof (internal_s->s_name) > SYMNMLEN)
{
/* This case implies that the matching symbol name
will be in the string table. */
abort ();
}
if (isym.n_scnum == section->target_index)
{
/* According to the MSVC documentation, the first
TWO entries with the section # are both of
interest to us. The first one is the "section
symbol" (section name). The second is the comdat
symbol name. Here, we've found the first
qualifying entry; we distinguish it from the
second with a state flag.
In the case of gas-generated (at least until that
is fixed) .o files, it isn't necessarily the
second one. It may be some other later symbol.
Since gas also doesn't follow MS conventions and
emits the section similar to .text$<name>, where
<something> is the name we're looking for, we
distinguish the two as follows:
If the section name is simply a section name (no
$) we presume it's MS-generated, and look at
precisely the second symbol for the comdat name.
If the section name has a $, we assume it's
gas-generated, and look for <something> (whatever
follows the $) as the comdat symbol. */
/* All 3 branches use this */
symname = _bfd_coff_internal_syment_name (abfd, &isym, buf);
if (symname == NULL)
abort ();
switch (seen_state)
{
case 0:
{
/* The first time we've seen the symbol. */
union internal_auxent aux;
seen_state = 1;
/* If it isn't the stuff we're expecting, die;
The MS documentation is vague, but it
appears that the second entry serves BOTH
as the comdat symbol and the defining
symbol record (either C_STAT or C_EXT,
possibly with an aux entry with debug
information if it's a function.) It
appears the only way to find the second one
is to count. (On Intel, they appear to be
adjacent, but on Alpha, they have been
found separated.)
Here, we think we've found the first one,
but there's some checking we can do to be
sure. */
if (! (isym.n_sclass == C_STAT
&& isym.n_type == T_NULL
&& isym.n_value == 0))
abort ();
/* FIXME LATER: MSVC generates section names
like .text for comdats. Gas generates
names like .text$foo__Fv (in the case of a
function). See comment above for more. */
if (strcmp (name, symname) != 0)
abort ();
/* This is the section symbol. */
bfd_coff_swap_aux_in (abfd, (PTR) (esym + bfd_coff_symesz (abfd)),
isym.n_type, isym.n_sclass,
0, isym.n_numaux, (PTR) &aux);
target_name = strchr (name, '$');
if (target_name != NULL)
{
/* Gas mode. */
seen_state = 2;
/* Skip the `$'. */
target_name += 1;
}
/* FIXME: Microsoft uses NODUPLICATES and
ASSOCIATIVE, but gnu uses ANY and
SAME_SIZE. Unfortunately, gnu doesn't do
the comdat symbols right. So, until we can
fix it to do the right thing, we are
temporarily disabling comdats for the MS
types (they're used in DLLs and C++, but we
don't support *their* C++ libraries anyway
- DJ. */
/* Cygwin does not follow the MS style, and
uses ANY and SAME_SIZE where NODUPLICATES
and ASSOCIATIVE should be used. For
Interix, we just do the right thing up
front. */
switch (aux.x_scn.x_comdat)
{
case IMAGE_COMDAT_SELECT_NODUPLICATES:
#ifdef STRICT_PE_FORMAT
sec_flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
#else
sec_flags &= ~SEC_LINK_ONCE;
case STYP_DSECT:
unhandled = "STYP_DSECT";
break;
case STYP_GROUP:
unhandled = "STYP_GROUP";
break;
case STYP_COPY:
unhandled = "STYP_COPY";
break;
case STYP_OVER:
unhandled = "STYP_OVER";
break;
#ifdef SEC_NEVER_LOAD
case STYP_NOLOAD:
sec_flags |= SEC_NEVER_LOAD;
break;
#endif
case IMAGE_SCN_MEM_READ:
/* Ignored, assume it always to be true. */
break;
case IMAGE_SCN_TYPE_NO_PAD:
/* Skip. */
break;
case IMAGE_SCN_LNK_OTHER:
unhandled = "IMAGE_SCN_LNK_OTHER";
break;
case IMAGE_SCN_MEM_NOT_CACHED:
unhandled = "IMAGE_SCN_MEM_NOT_CACHED";
break;
case IMAGE_SCN_MEM_NOT_PAGED:
unhandled = "IMAGE_SCN_MEM_NOT_PAGED";
break;
case IMAGE_SCN_MEM_EXECUTE:
sec_flags |= SEC_CODE;
break;
case IMAGE_SCN_MEM_WRITE:
sec_flags &= ~ SEC_READONLY;
break;
case IMAGE_SCN_MEM_DISCARDABLE:
sec_flags |= SEC_DEBUGGING;
break;
case IMAGE_SCN_MEM_SHARED:
sec_flags |= SEC_SHARED;
break;
case IMAGE_SCN_LNK_REMOVE:
sec_flags |= SEC_EXCLUDE;
break;
case IMAGE_SCN_CNT_CODE:
sec_flags |= SEC_CODE | SEC_ALLOC | SEC_LOAD;
break;
case IMAGE_SCN_CNT_INITIALIZED_DATA:
sec_flags |= SEC_DATA | SEC_ALLOC | SEC_LOAD;
break;
case IMAGE_SCN_CNT_UNINITIALIZED_DATA:
sec_flags |= SEC_ALLOC;
break;
case IMAGE_SCN_LNK_INFO:
/* We mark these as SEC_DEBUGGING, but only if COFF_PAGE_SIZE is
defined. coff_compute_section_file_positions uses
COFF_PAGE_SIZE to ensure that the low order bits of the
section VMA and the file offset match. If we don't know
COFF_PAGE_SIZE, we can't ensure the correct correspondence,
and demand page loading of the file will fail. */
#ifdef COFF_PAGE_SIZE
sec_flags |= SEC_DEBUGGING;
#endif
break;
case IMAGE_COMDAT_SELECT_ANY:
sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
break;
case IMAGE_COMDAT_SELECT_SAME_SIZE:
sec_flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
break;
case IMAGE_COMDAT_SELECT_EXACT_MATCH:
/* Not yet fully implemented ??? */
sec_flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
break;
/* debug$S gets this case; other
implications ??? */
/* There may be no symbol... we'll search
the whole table... Is this the right
place to play this game? Or should we do
it when reading it in. */
case IMAGE_COMDAT_SELECT_ASSOCIATIVE:
#ifdef STRICT_PE_FORMAT
/* FIXME: This is not currently implemented. */
sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
#else
sec_flags &= ~SEC_LINK_ONCE;
#endif
break;
default: /* 0 means "no symbol" */
/* debug$F gets this case; other
implications ??? */
sec_flags |= SEC_LINK_DUPLICATES_DISCARD;
break;
}
}
break;
case 2:
/* Gas mode: the first matching on partial name. */
#ifndef TARGET_UNDERSCORE
#define TARGET_UNDERSCORE 0
#endif
/* Is this the name we're looking for? */
if (strcmp (target_name,
symname + (TARGET_UNDERSCORE ? 1 : 0)) != 0)
{
/* Not the name we're looking for */
esym += (isym.n_numaux + 1) * bfd_coff_symesz (abfd);
continue;
}
/* Fall through. */
case 1:
/* MSVC mode: the lexically second symbol (or
drop through from the above). */
{
char *newname;
/* This must the the second symbol with the
section #. It is the actual symbol name.
Intel puts the two adjacent, but Alpha (at
least) spreads them out. */
section->comdat =
bfd_alloc (abfd, sizeof (struct bfd_comdat_info));
if (section->comdat == NULL)
abort ();
section->comdat->symbol =
(esym - esymstart) / bfd_coff_symesz (abfd);
newname = bfd_alloc (abfd, strlen (symname) + 1);
if (newname == NULL)
abort ();
strcpy (newname, symname);
section->comdat->name = newname;
}
goto breakloop;
}
}
esym += (isym.n_numaux + 1) * bfd_coff_symesz (abfd);
}
breakloop:
/* SunOS requires a statement after any label. */
;
break;
case IMAGE_SCN_LNK_COMDAT:
/* COMDAT gets very special treatment. */
sec_flags = handle_COMDAT (abfd, sec_flags, hdr, name, section);
break;
default:
/* Silently ignore for now. */
break;
}
/* If the section flag was not handled, report it here. This will allow
users of the BFD library to report a problem but continue executing.
Tools which need to be aware of these problems (such as the linker)
can override the default bfd_error_handler to intercept these reports. */
if (unhandled != NULL)
(*_bfd_error_handler)
(_("%s (%s): Section flag %s (0x%x) ignored"),
bfd_get_filename (abfd), name, unhandled, flag);
}
#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)

543
bfd/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2001-02-18 15:14-0800\n"
"POT-Creation-Date: 2001-02-26 17:19-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -326,37 +326,42 @@ msgstr ""
msgid "Warning: Clearing the interworking flag of %s due to outside request"
msgstr ""
#: coffcode.h:2136
#: coffcode.h:1080
#, c-format
msgid "%s (%s): Section flag %s (0x%x) ignored"
msgstr ""
#: coffcode.h:2194
#, c-format
msgid "Unrecognized TI COFF target id '0x%x'"
msgstr ""
#: coffcode.h:4194
#: coffcode.h:4252
#, c-format
msgid "%s: warning: illegal symbol index %ld in line numbers"
msgstr ""
#: coffcode.h:4208
#: coffcode.h:4266
#, c-format
msgid "%s: warning: duplicate line number information for `%s'"
msgstr ""
#: coffcode.h:4568
#: coffcode.h:4626
#, c-format
msgid "%s: Unrecognized storage class %d for %s symbol `%s'"
msgstr ""
#: coffcode.h:4699
#: coffcode.h:4757
#, c-format
msgid "warning: %s: local symbol `%s' has no section"
msgstr ""
#: coff-tic54x.c:376 coffcode.h:4810
#: coff-tic54x.c:376 coffcode.h:4868
#, c-format
msgid "%s: warning: illegal symbol index %ld in relocs"
msgstr ""
#: coffcode.h:4848
#: coffcode.h:4906
#, c-format
msgid "%s: illegal relocation type %d at address 0x%lx"
msgstr ""
@ -890,7 +895,7 @@ msgstr ""
msgid "%s: ABI mismatch: linking %s module with previous %s modules"
msgstr ""
#: elf32-mips.c:2673 elf32-ppc.c:1477 elf64-sparc.c:2991
#: elf32-mips.c:2673 elf32-ppc.c:1477 elf64-sparc.c:2998
#, c-format
msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"
msgstr ""
@ -1078,12 +1083,12 @@ msgstr ""
msgid "%s: probably compiled without -fPIC?"
msgstr ""
#: elf32-sparc.c:1962
#: elf32-sparc.c:1969
#, c-format
msgid "%s: compiled for a 64 bit system and target is 32 bit"
msgstr ""
#: elf32-sparc.c:1976
#: elf32-sparc.c:1983
#, c-format
msgid "%s: linking little endian files with big endian files"
msgstr ""
@ -1194,7 +1199,7 @@ msgstr ""
msgid "Symbol `%s' has differing types: REGISTER in %s, %s in %s"
msgstr ""
#: elf64-sparc.c:2972
#: elf64-sparc.c:2979
#, c-format
msgid "%s: linking UltraSPARC specific with HAL specific code"
msgstr ""

View File

@ -1,3 +1,10 @@
2001-02-26 H.J. Lu <hjl@gnu.org>
* ldlang.c (open_input_bfds): Set the bfd error handler so
that problems can be caught whilst loading symbols.
(record_bfd_errors): New function: Report BFD errors and mark
the executable output as being invalid.
2001-02-22 Timothy Wall <twall@cygnus.com>
* configure.host: Add configuration for ia64-*-aix*.

View File

@ -127,6 +127,7 @@ static bfd_vma size_input_section
fill_type, bfd_vma, boolean));
static void lang_finish PARAMS ((void));
static void ignore_bfd_errors PARAMS ((const char *, ...));
static void record_bfd_errors PARAMS ((const char *, ...));
static void lang_check PARAMS ((void));
static void lang_common PARAMS ((void));
static boolean lang_one_common PARAMS ((struct bfd_link_hash_entry *, PTR));
@ -1894,6 +1895,7 @@ open_input_bfds (s, force)
if (s->input_statement.real)
{
lang_statement_list_type add;
bfd_error_handler_type pfn;
s->input_statement.target = current_target;
@ -1908,10 +1910,17 @@ open_input_bfds (s, force)
bfd_archive))
s->input_statement.loaded = false;
lang_list_init (&add);
lang_list_init (& add);
/* We need to know if an error occurs whilst loading the
symbols, since this means that a valid executable can
not be produced. */
pfn = bfd_set_error_handler (record_bfd_errors);
load_symbols (&s->input_statement, &add);
bfd_set_error_handler (pfn);
if (add.head != NULL)
{
*add.tail = s->next;
@ -3435,6 +3444,53 @@ lang_finish ()
}
}
/* This is the routine to handle BFD error messages. */
#ifdef ANSI_PROTOTYPES
static void
record_bfd_errors (const char *s, ...)
{
va_list p;
einfo ("%P: ");
va_start (p, s);
vfprintf (stderr, s, p);
va_end (p);
fprintf (stderr, "\n");
einfo ("%X");
}
#else /* ! defined (ANSI_PROTOTYPES) */
static void
record_bfd_errors (va_alist)
va_dcl
{
va_list p;
const char *s;
einfo ("%P: ");
va_start (p);
s = va_arg (p, const char *);
vfprintf (stderr, s, p);
va_end (p);
fprintf (stderr, "\n");
einfo ("%X");
}
#endif /* ! defined (ANSI_PROTOTYPES) */
/* This is a small function used when we want to ignore errors from
BFD. */

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2001-02-18 11:47-0800\n"
"POT-Creation-Date: 2001-02-26 16:28-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -250,7 +250,7 @@ msgstr ""
msgid "Errors encountered processing file %s for interworking"
msgstr ""
#: emultempl/pe.em:1094 ldlang.c:1994 ldlang.c:4363 ldlang.c:4396
#: emultempl/pe.em:1094 ldlang.c:2003 ldlang.c:4419 ldlang.c:4452
#: ldmain.c:1016
msgid "%P%F: bfd_link_hash_lookup failed: %E\n"
msgstr ""
@ -427,230 +427,230 @@ msgstr ""
msgid "%F%P: cannot open %s: %E\n"
msgstr ""
#: ldfile.c:250
#: ldfile.c:259
msgid "%F%P: cannot find %s\n"
msgstr ""
#: ldfile.c:269 ldfile.c:285
#: ldfile.c:278 ldfile.c:294
#, c-format
msgid "cannot find script file %s\n"
msgstr ""
#: ldfile.c:271 ldfile.c:287
#: ldfile.c:280 ldfile.c:296
#, c-format
msgid "opened script file %s\n"
msgstr ""
#: ldfile.c:336
#: ldfile.c:345
msgid "%P%F: cannot open linker script file %s: %E\n"
msgstr ""
#: ldfile.c:373
#: ldfile.c:382
msgid "%P%F: unknown architecture: %s\n"
msgstr ""
#: ldfile.c:389
#: ldfile.c:398
msgid "%P%F: target architecture respecified\n"
msgstr ""
#: ldfile.c:444
#: ldfile.c:453
msgid "%P%F: cannot represent machine `%s'\n"
msgstr ""
#: ldlang.c:749
#: ldlang.c:750
msgid ""
"\n"
"Memory Configuration\n"
"\n"
msgstr ""
#: ldlang.c:751
#: ldlang.c:752
msgid "Name"
msgstr ""
#: ldlang.c:751
#: ldlang.c:752
msgid "Origin"
msgstr ""
#: ldlang.c:751
#: ldlang.c:752
msgid "Length"
msgstr ""
#: ldlang.c:751
#: ldlang.c:752
msgid "Attributes"
msgstr ""
#: ldlang.c:793
#: ldlang.c:794
msgid ""
"\n"
"Linker script and memory map\n"
"\n"
msgstr ""
#: ldlang.c:810
#: ldlang.c:811
msgid "%P%F: Illegal use of `%s' section"
msgstr ""
#: ldlang.c:820
#: ldlang.c:821
msgid "%P%F: output format %s cannot represent section called %s\n"
msgstr ""
#: ldlang.c:982
#: ldlang.c:983
msgid "%P: %B: warning: ignoring duplicate section `%s'\n"
msgstr ""
#: ldlang.c:985
#: ldlang.c:986
msgid "%P: %B: warning: ignoring duplicate `%s' section symbol `%s'\n"
msgstr ""
#: ldlang.c:999
#: ldlang.c:1000
msgid "%P: %B: warning: duplicate section `%s' has different size\n"
msgstr ""
#: ldlang.c:1050
#: ldlang.c:1051
msgid "%P%F: Failed to create hash table\n"
msgstr ""
#: ldlang.c:1440
#: ldlang.c:1441
msgid "%B: file not recognized: %E\n"
msgstr ""
#: ldlang.c:1441
#: ldlang.c:1442
msgid "%B: matching formats:"
msgstr ""
#: ldlang.c:1448
#: ldlang.c:1449
msgid "%F%B: file not recognized: %E\n"
msgstr ""
#: ldlang.c:1501
#: ldlang.c:1502
msgid "%F%B: object %B in archive is not object\n"
msgstr ""
#: ldlang.c:1507 ldlang.c:1519
#: ldlang.c:1508 ldlang.c:1520
msgid "%F%B: could not read symbols: %E\n"
msgstr ""
#: ldlang.c:1779
#: ldlang.c:1780
msgid ""
"%P: warning: could not find any targets that match endianness requirement\n"
msgstr ""
#: ldlang.c:1792
#: ldlang.c:1793
msgid "%P%F: target %s not found\n"
msgstr ""
#: ldlang.c:1794
#: ldlang.c:1795
msgid "%P%F: cannot open output file %s: %E\n"
msgstr ""
#: ldlang.c:1804
#: ldlang.c:1805
msgid "%P%F:%s: can not make object file: %E\n"
msgstr ""
#: ldlang.c:1808
#: ldlang.c:1809
msgid "%P%F:%s: can not set architecture: %E\n"
msgstr ""
#: ldlang.c:1812
#: ldlang.c:1813
msgid "%P%F: can not create link hash table: %E\n"
msgstr ""
#: ldlang.c:2117
#: ldlang.c:2126
msgid " load address 0x%V"
msgstr ""
#: ldlang.c:2247
#: ldlang.c:2256
msgid "%W (size before relaxing)\n"
msgstr ""
#: ldlang.c:2329
#: ldlang.c:2338
#, c-format
msgid "Address of section %s set to "
msgstr ""
#: ldlang.c:2478
#: ldlang.c:2487
#, c-format
msgid "Fail with %d\n"
msgstr ""
#: ldlang.c:2716
#: ldlang.c:2725
msgid "%X%P: section %s [%V -> %V] overlaps section %s [%V -> %V]\n"
msgstr ""
#: ldlang.c:2750
#: ldlang.c:2759
msgid "%X%P: address 0x%v of %B section %s is not within region %s\n"
msgstr ""
#: ldlang.c:2758
#: ldlang.c:2767
msgid "%X%P: region %s is full (%B section %s)\n"
msgstr ""
#: ldlang.c:2807
#: ldlang.c:2816
msgid "%P%X: Internal error on COFF shared library section %s\n"
msgstr ""
#: ldlang.c:2848
#: ldlang.c:2857
msgid "%P: warning: no memory region specified for section `%s'\n"
msgstr ""
#: ldlang.c:2861
#: ldlang.c:2870
msgid "%P: warning: changing start of section %s by %u bytes\n"
msgstr ""
#: ldlang.c:2875
#: ldlang.c:2884
msgid "%F%S: non constant address expression for section %s\n"
msgstr ""
#: ldlang.c:2940
#: ldlang.c:2949
msgid "%X%P: use an absolute load address or a load memory region, not both\n"
msgstr ""
#: ldlang.c:3056
#: ldlang.c:3065
msgid "%P%F: can't relax section: %E\n"
msgstr ""
#: ldlang.c:3223
#: ldlang.c:3232
msgid "%F%P: invalid data statement\n"
msgstr ""
#: ldlang.c:3260
#: ldlang.c:3269
msgid "%F%P: invalid reloc statement\n"
msgstr ""
#: ldlang.c:3396
#: ldlang.c:3405
msgid "%P%F:%s: can't set start address\n"
msgstr ""
#: ldlang.c:3409 ldlang.c:3426
#: ldlang.c:3418 ldlang.c:3435
msgid "%P%F: can't set start address\n"
msgstr ""
#: ldlang.c:3421
#: ldlang.c:3430
msgid "%P: warning: cannot find entry symbol %s; defaulting to %V\n"
msgstr ""
#: ldlang.c:3431
#: ldlang.c:3440
msgid "%P: warning: cannot find entry symbol %s; not setting start address\n"
msgstr ""
#: ldlang.c:3473
#: ldlang.c:3529
msgid ""
"%P: warning: %s architecture of input file `%B' is incompatible with %s "
"output\n"
msgstr ""
#: ldlang.c:3494
#: ldlang.c:3550
msgid "%E%X: failed to merge target specific data of file %B\n"
msgstr ""
#: ldlang.c:3581
#: ldlang.c:3637
msgid ""
"\n"
"Allocating common symbols\n"
msgstr ""
#: ldlang.c:3582
#: ldlang.c:3638
msgid ""
"Common symbol size file\n"
"\n"
@ -659,43 +659,43 @@ msgstr ""
#. This message happens when using the
#. svr3.ifile linker script, so I have
#. disabled it.
#: ldlang.c:3664
#: ldlang.c:3720
msgid "%P: no [COMMON] command, defaulting to .bss\n"
msgstr ""
#: ldlang.c:3723
#: ldlang.c:3779
msgid "%P%F: invalid syntax in flags\n"
msgstr ""
#: ldlang.c:4312
#: ldlang.c:4368
msgid "%P%Fmultiple STARTUP files\n"
msgstr ""
#: ldlang.c:4582
#: ldlang.c:4638
msgid "%F%P: bfd_record_phdr failed: %E\n"
msgstr ""
#: ldlang.c:4601
#: ldlang.c:4657
msgid "%X%P: section `%s' assigned to non-existent phdr `%s'\n"
msgstr ""
#: ldlang.c:4916
#: ldlang.c:4972
msgid "%X%P: unknown language `%s' in version information\n"
msgstr ""
#: ldlang.c:4965
#: ldlang.c:5021
msgid "%X%P: duplicate version tag `%s'\n"
msgstr ""
#: ldlang.c:4978 ldlang.c:4991
#: ldlang.c:5034 ldlang.c:5047
msgid "%X%P: duplicate expression `%s' in version information\n"
msgstr ""
#: ldlang.c:5028
#: ldlang.c:5084
msgid "%X%P: unable to find version dependency `%s'\n"
msgstr ""
#: ldlang.c:5050
#: ldlang.c:5106
msgid "%X%P: unable to read .exports section contents"
msgstr ""