public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH,RFC] collect2 LTO for AIX
@ 2017-10-13 18:07 David Edelsohn
  2017-10-30 19:20 ` Jeff Law
  2019-07-04 15:04 ` Martin Liška
  0 siblings, 2 replies; 12+ messages in thread
From: David Edelsohn @ 2017-10-13 18:07 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 722 bytes --]

The attached patch is an incremental step toward GCC LTO on AIX.  The
recent Libiberty Simple Object improvements for XCOFF provide more
capabilities for operations on XCOFF object files, which are a
prerequisite for GCC LTO functionality.

This patch adds the basic LTO scanning pass to the COFF support in
collect2.  I don't believe that this change should affect other COFF
targets adversely (do they even use collect2?), but I wanted to give
people an opportunity to comment.

(Yes, the formatting is messy, but all of collect2.c is messy.)

Bootstrapped on powerpc-ibm-aix7.2.0.0

Thanks, David

* collect2.c (add_lto_object): Compile for OBJECT_COFF.
(scan_prog_file): Don't skip PASS_LTOINFO. Scan for LTO objects.

[-- Attachment #2: collect2-aix-lto.txt --]
[-- Type: text/plain, Size: 1886 bytes --]

Index: collect2.c
===================================================================
--- collect2.c	(revision 253736)
+++ collect2.c	(working copy)
@@ -614,7 +614,7 @@ static const char *const target_machine = TARGET_M
 
    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, cons
 
   list->last = n;
 }
-#endif /* OBJECT_FORMAT_NONE */
+#endif
 
 
 /* Perform a link-time recompilation and relink if any of the object
@@ -2750,8 +2750,10 @@ scan_prog_file (const char *prog_name, scanpass wh
   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 +2766,7 @@ scan_prog_file (const char *prog_name, scanpass wh
      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 +2809,19 @@ scan_prog_file (const char *prog_name, scanpass wh
 			++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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-07-06  1:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 18:07 [PATCH,RFC] collect2 LTO for AIX David Edelsohn
2017-10-30 19:20 ` Jeff Law
2017-10-31 19:28   ` David Edelsohn
2017-11-01 19:21     ` Jim Wilson
2017-11-06 16:01     ` Jim Wilson
2017-11-06 17:01       ` Jim Wilson
2017-11-06 17:34       ` David Edelsohn
2017-11-01 19:20   ` Jim Wilson
2019-07-04 15:04 ` Martin Liška
2019-07-04 15:27   ` David Edelsohn
2019-07-04 15:53     ` Martin Liška
2019-07-06  3:11       ` David Edelsohn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).