elf: Add PT_GNU_PROPERTY segment type
[binutils-gdb.git] / gas / as.c
index 02c7d2970bf3c4690aa684c9d6446f6731395a79..c4de060c9df7ed5ca7dda73fe382f764b437a2cf 100644 (file)
--- a/gas/as.c
+++ b/gas/as.c
@@ -301,7 +301,12 @@ Options:\n\
   --size-check=[error|warning]\n\
                          ELF .size directive check (default --size-check=error)\n"));
   fprintf (stream, _("\
-  --elf-stt-common=[no|yes]\n\
+  --elf-stt-common=[no|yes] "));
+  if (DEFAULT_GENERATE_ELF_STT_COMMON)
+    fprintf (stream, _("(default: yes)\n"));
+  else
+    fprintf (stream, _("(default: no)\n"));
+  fprintf (stream, _("\
                           generate ELF common symbols with STT_COMMON type\n"));
   fprintf (stream, _("\
   --sectname-subst        enable section name substitution sequences\n"));
@@ -1234,7 +1239,8 @@ main (int argc, char ** argv)
   out_file_name = OBJ_DEFAULT_OUTPUT_FILE_NAME;
 
   hex_init ();
-  bfd_init ();
+  if (bfd_init () != BFD_INIT_MAGIC)
+    as_fatal (_("libbfd ABI mismatch"));
   bfd_set_error_program_name (myname);
 
 #ifdef USE_EMULATIONS
@@ -1254,14 +1260,27 @@ main (int argc, char ** argv)
        {
          struct stat sib;
 
-         if (stat (argv[i], &sib) == 0)
+         /* Check that the input file and output file are different.  */
+         if (stat (argv[i], &sib) == 0
+             && sib.st_ino == sob.st_ino
+             /* POSIX emulating systems may support stat() but if the
+                underlying file system does not support a file serial number
+                of some kind then they will return 0 for the inode.  So
+                two files with an inode of 0 may not actually be the same.
+                On real POSIX systems no ordinary file will ever have an
+                inode of 0.  */
+             && sib.st_ino != 0
+             /* Different files may have the same inode number if they
+                reside on different devices, so check the st_dev field as
+                well.  */
+             && sib.st_dev == sob.st_dev)
            {
-             if (sib.st_ino == sob.st_ino && sib.st_ino != 0)
-               {
-                 /* Don't let as_fatal remove the output file!  */
-                 out_file_name = NULL;
-                 as_fatal (_("The input and output files must be distinct"));
-               }
+             const char *saved_out_file_name = out_file_name;
+
+             /* Don't let as_fatal remove the output file!  */
+             out_file_name = NULL;
+             as_fatal (_("The input '%s' and output '%s' files are the same"),
+                       argv[i], saved_out_file_name);
            }
        }
     }