Update sources to GPLv3
[deliverable/binutils-gdb.git] / ld / emultempl / aix.em
index 72c865dd144cdae60d7afb72ca4cb5b587294615..df983b14a8e14ad3507f05213b353adf38bcd423 100644 (file)
@@ -9,32 +9,34 @@ cat >e${EMULATION_NAME}.c <<EOF
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* AIX emulation code for ${EMULATION_NAME}
-   Copyright 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004
+   Copyright 1991, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+   2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
    Written by Steve Chamberlain <sac@cygnus.com>
    AIX support by Ian Lance Taylor <ian@cygnus.com>
    AIX 64 bit support by Tom Rix <trix@redhat.com>
 
-This file is part of GLD, the Gnu Linker.
+   This file is part of the GNU Binutils.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #define TARGET_IS_${EMULATION_NAME}
 
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "libiberty.h"
 #include "safe-ctype.h"
 #include "getopt.h"
@@ -267,7 +269,7 @@ gld${EMULATION_NAME}_parse_args (int argc, char **argv)
   if (indx == 0)
     indx = 1;
 
-  if (indx < argc && strncmp (argv[indx], "-b", 2) == 0)
+  if (indx < argc && CONST_STRNEQ (argv[indx], "-b"))
     {
       char *s;
 
@@ -650,18 +652,52 @@ gld${EMULATION_NAME}_before_allocation (void)
       size_t len;
       search_dirs_type *search;
 
-      len = strlen (search_head->name);
-      libpath = xmalloc (len + 1);
-      strcpy (libpath, search_head->name);
-      for (search = search_head->next; search != NULL; search = search->next)
+      /* PR ld/4023: Strip sysroot prefix from any paths
+        being inserted into the output binary's DT_RPATH.  */
+      if (ld_sysroot != NULL
+         && * ld_sysroot != 0)
+       {
+         const char * name = search_head->name;
+         size_t ld_sysroot_len = strlen (ld_sysroot);
+
+         if (strncmp (name, ld_sysroot, ld_sysroot_len) == 0)
+           name += ld_sysroot_len;
+
+         len = strlen (name);
+         libpath = xmalloc (len + 1);
+         strcpy (libpath, name);
+
+         for (search = search_head->next; search != NULL; search = search->next)
+           {
+             size_t nlen;
+
+             name = search->name;
+             if (strncmp (name, ld_sysroot, ld_sysroot_len) == 0)
+               name += ld_sysroot_len;
+
+             nlen = strlen (name);
+             libpath = xrealloc (libpath, len + nlen + 2);
+             libpath[len] = ':';
+             strcpy (libpath + len + 1, name);
+             len += nlen + 1;
+           }
+       }
+      else
        {
-         size_t nlen;
+         len = strlen (search_head->name);
+         libpath = xmalloc (len + 1);
+         strcpy (libpath, search_head->name);
 
-         nlen = strlen (search->name);
-         libpath = xrealloc (libpath, len + nlen + 2);
-         libpath[len] = ':';
-         strcpy (libpath + len + 1, search->name);
-         len += nlen + 1;
+         for (search = search_head->next; search != NULL; search = search->next)
+           {
+             size_t nlen;
+
+             nlen = strlen (search->name);
+             libpath = xrealloc (libpath, len + nlen + 2);
+             libpath[len] = ':';
+             strcpy (libpath + len + 1, search->name);
+             len += nlen + 1;
+           }
        }
     }
 
@@ -786,6 +822,8 @@ gld${EMULATION_NAME}_before_allocation (void)
                                 &is->header.next);
        }
     }
+
+  before_allocation_default ();
 }
 
 static char *
@@ -1339,7 +1377,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = {
   gld${EMULATION_NAME}_get_script,
   "${EMULATION_NAME}",
   "${OUTPUT_FORMAT}",
-  0,                           /* finish */
+  finish_default,
   gld${EMULATION_NAME}_create_output_section_statements,
   0,                           /* open_dynamic_archive */
   0,                           /* place_orphan */
This page took 0.025258 seconds and 4 git commands to generate.