summaryrefslogtreecommitdiff
path: root/gcc/collect2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/collect2.c')
-rw-r--r--gcc/collect2.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/gcc/collect2.c b/gcc/collect2.c
index ddbd2be8bf8..d25b75697c0 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -614,7 +614,7 @@ static const char *const target_machine = TARGET_MACHINE;
Return 0 if not found, otherwise return its name, allocated with malloc. */
-#ifdef OBJECT_FORMAT_NONE
+#if defined (OBJECT_FORMAT_NONE) || defined (OBJECT_FORMAT_COFF)
/* Add an entry for the object file NAME to object file list LIST.
New entries are added at the end of the list. The original pointer
@@ -634,7 +634,7 @@ add_lto_object (struct lto_object_list *list, const char *name)
list->last = n;
}
-#endif /* OBJECT_FORMAT_NONE */
+#endif
/* Perform a link-time recompilation and relink if any of the object
@@ -2641,17 +2641,6 @@ scan_libraries (const char *prog_name)
#ifdef OBJECT_FORMAT_COFF
-#if defined (EXTENDED_COFF)
-
-# define GCC_SYMBOLS(X) (SYMHEADER (X).isymMax + SYMHEADER (X).iextMax)
-# define GCC_SYMENT SYMR
-# define GCC_OK_SYMBOL(X) ((X).st == stProc || (X).st == stGlobal)
-# define GCC_SYMINC(X) (1)
-# define GCC_SYMZERO(X) (SYMHEADER (X).isymMax)
-# define GCC_CHECK_HDR(X) (PSYMTAB (X) != 0)
-
-#else
-
# define GCC_SYMBOLS(X) (HEADER (ldptr).f_nsyms)
# define GCC_SYMENT SYMENT
# if defined (C_WEAKEXT)
@@ -2690,8 +2679,6 @@ scan_libraries (const char *prog_name)
&& !(HEADER (X).f_flags & F_LOADONLY))
#endif
-#endif
-
#ifdef COLLECT_EXPORT_LIST
/* Array of standard AIX libraries which should not
be scanned for ctors/dtors. */
@@ -2750,8 +2737,10 @@ scan_prog_file (const char *prog_name, scanpass which_pass,
LDFILE *ldptr = NULL;
int sym_index, sym_count;
int is_shared = 0;
+ int found_lto = 0;
- if (which_pass != PASS_FIRST && which_pass != PASS_OBJ)
+ if (which_pass != PASS_FIRST && which_pass != PASS_OBJ
+ && which_pass != PASS_LTOINFO)
return;
#ifdef COLLECT_EXPORT_LIST
@@ -2764,6 +2753,7 @@ scan_prog_file (const char *prog_name, scanpass which_pass,
eliminate scan_libraries() function. */
do
{
+ found_lto = 0;
#endif
/* Some platforms (e.g. OSF4) declare ldopen as taking a
non-const char * filename parameter, even though it will not
@@ -2806,6 +2796,19 @@ scan_prog_file (const char *prog_name, scanpass which_pass,
++name;
#endif
+ if (which_pass == PASS_LTOINFO)
+ {
+ if (found_lto)
+ continue;
+ if (strncmp (name, "__gnu_lto_v1", 12) == 0)
+ {
+ add_lto_object (&lto_objects, prog_name);
+ found_lto = 1;
+ break;
+ }
+ continue;
+ }
+
switch (is_ctor_dtor (name))
{
#if TARGET_AIX_VERSION
@@ -2904,16 +2907,10 @@ scan_prog_file (const char *prog_name, scanpass which_pass,
}
if (debug)
-#if !defined(EXTENDED_COFF)
fprintf (stderr, "\tsec=%d class=%d type=%s%o %s\n",
symbol.n_scnum, symbol.n_sclass,
(symbol.n_type ? "0" : ""), symbol.n_type,
name);
-#else
- fprintf (stderr,
- "\tiss = %5d, value = %5ld, index = %5d, name = %s\n",
- symbol.iss, (long) symbol.value, symbol.index, name);
-#endif
}
}
}