Inline abbrev lookup
[deliverable/binutils-gdb.git] / ld / lexsup.c
index 04db2f129f872891b5d97ccb223e023a6cf21140..49c4f23950dda582b35e4ab0291d2244356cafd1 100644 (file)
@@ -359,7 +359,7 @@ static const struct ld_option ld_options[] =
   { {"init", required_argument, NULL, OPTION_INIT},
     '\0', N_("SYMBOL"), N_("Call SYMBOL at load-time"), ONE_DASH },
   { {"Map", required_argument, NULL, OPTION_MAP},
-    '\0', N_("FILE"), N_("Write a map file"), ONE_DASH },
+    '\0', N_("[FILE]"), N_("Write a map file (default: <outputname>.map)"), ONE_DASH },
   { {"no-define-common", no_argument, NULL, OPTION_NO_DEFINE_COMMON},
     '\0', NULL, N_("Do not define Common storage"), TWO_DASHES },
   { {"no-demangle", no_argument, NULL, OPTION_NO_DEMANGLE },
@@ -516,9 +516,11 @@ static const struct ld_option ld_options[] =
   { {"warn-section-align", no_argument, NULL, OPTION_WARN_SECTION_ALIGN},
     '\0', NULL, N_("Warn if start of section changes due to alignment"),
     TWO_DASHES },
-  { {"warn-shared-textrel", no_argument, NULL, OPTION_WARN_SHARED_TEXTREL},
-    '\0', NULL, N_("Warn if shared object has DT_TEXTREL"),
+  { {"warn-textrel", no_argument, NULL, OPTION_WARN_TEXTREL},
+    '\0', NULL, N_("Warn if outpout has DT_TEXTREL"),
     TWO_DASHES },
+  { {"warn-shared-textrel", no_argument, NULL, OPTION_WARN_TEXTREL},
+    '\0', NULL, NULL, NO_HELP },
   { {"warn-alternate-em", no_argument, NULL, OPTION_WARN_ALTERNATE_EM},
     '\0', NULL, N_("Warn if an object has alternate ELF machine code"),
     TWO_DASHES },
@@ -1438,8 +1440,8 @@ parse_args (unsigned argc, char **argv)
        case OPTION_WARN_SECTION_ALIGN:
          config.warn_section_align = TRUE;
          break;
-       case OPTION_WARN_SHARED_TEXTREL:
-         link_info.warn_shared_textrel = TRUE;
+       case OPTION_WARN_TEXTREL:
+         link_info.textrel_check = textrel_check_warning;
          break;
        case OPTION_WARN_ALTERNATE_EM:
          link_info.warn_alternate_em = TRUE;
@@ -1593,6 +1595,37 @@ parse_args (unsigned argc, char **argv)
        }
     }
 
+  /* Run a couple of checks on the map filename.  */
+  if (config.map_filename)
+    {
+      /* If name has been provided then use the
+        output filename with a .map extension.  */
+      if (config.map_filename[0] == 0)
+       {
+         /* FIXME: This is a memory leak as the string is never freed.  */
+         if (asprintf (&config.map_filename, "%s.map", output_filename) < 0)
+           einfo (_("%F%P: %s: can not create name of map file: %E\n"));
+       }
+      else
+       {
+         struct stat s;
+
+         /* If the map filename is actually a directory then create
+            a file inside it, again based upon the output filename.  */
+         if (stat (config.map_filename, &s) >= 0
+             && S_ISDIR (s.st_mode))
+           {
+             char * new_name;
+
+             /* FIXME: Another memory leak.  */
+             if (asprintf (&new_name, "%s/%s.map",
+                           config.map_filename, output_filename) < 0)
+               einfo (_("%F%P: %s: can not create name of map file: %E\n"));
+             config.map_filename = new_name;
+           }
+       }
+    }
+
   if (command_line.soname && command_line.soname[0] == '\0')
     {
       einfo (_("%P: SONAME must not be empty string; ignored\n"));
@@ -1846,12 +1879,26 @@ elf_shlib_list_options (FILE *file)
   -z nocommon                 Generate common symbols with STT_OBJECT type\n"));
   fprintf (file, _("\
   -z stack-size=SIZE          Set size of stack segment\n"));
-  fprintf (file, _("\
-  -z text                     Treat DT_TEXTREL in shared object as error\n"));
-  fprintf (file, _("\
-  -z notext                   Don't treat DT_TEXTREL in shared object as error\n"));
-  fprintf (file, _("\
-  -z textoff                  Don't treat DT_TEXTREL in shared object as error\n"));
+  if (link_info.textrel_check == textrel_check_error)
+    fprintf (file, _("\
+  -z text                     Treat DT_TEXTREL in output as error (default)\n"));
+  else
+    fprintf (file, _("\
+  -z text                     Treat DT_TEXTREL in output as error\n"));
+  if (link_info.textrel_check == textrel_check_none)
+    {
+      fprintf (file, _("\
+  -z notext                   Don't treat DT_TEXTREL in output as error (default)\n"));
+      fprintf (file, _("\
+  -z textoff                  Don't treat DT_TEXTREL in output as error (default)\n"));
+    }
+  else
+    {
+      fprintf (file, _("\
+  -z notext                   Don't treat DT_TEXTREL in output as error\n"));
+      fprintf (file, _("\
+  -z textoff                  Don't treat DT_TEXTREL in output as error\n"));
+    }
 }
 
 static void
This page took 0.024937 seconds and 4 git commands to generate.