]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix --section-start=xxxx
authorAlan Modra <amodra@gmail.com>
Sat, 8 Jul 2000 13:35:05 +0000 (13:35 +0000)
committerAlan Modra <amodra@gmail.com>
Sat, 8 Jul 2000 13:35:05 +0000 (13:35 +0000)
ld/ChangeLog
ld/lexsup.c

index 1965b47d61142d46d6ed0dc7cbc7ddbebee1db51..4109d25c535f8ce5e3938bc1dd037608bebbd176 100644 (file)
@@ -1,3 +1,7 @@
+2000-07-08  Alan Modra  <alan@linuxcare.com.au>
+
+       * lexsup.c (parse_args): Copy section name.
+
 2000-07-07  Charles Wilson  <cwilson@ece.gatech.edu>
 
        * ld/emultempl/pe.em: institute the following search order for
index 2869d494903d5a404b2c4d8660adb1f1098eb170..a018f28d95d9c4573b21b0487de13f58a141c04d 100644 (file)
@@ -847,6 +847,8 @@ parse_args (argc, argv)
        case OPTION_SECTION_START:
          {
            char *optarg2;
+           char *sec_name;
+           int len;
 
            /* Check for <something>=<somthing>...  */
            optarg2 = strchr (optarg, '=');
@@ -869,12 +871,15 @@ parse_args (argc, argv)
                xexit (1);
              }
 
-           optarg2[-1] = '\0';
+           /* We must copy the section name as set_section_start
+              doesn't do it for us.  */
+           len = optarg2 - optarg;
+           sec_name = xmalloc (len);
+           memcpy (sec_name, optarg, len - 1);
+           sec_name[len - 1] = 0;
 
            /* Then set it...  */
-           set_section_start (optarg, optarg2);
-           
-           optarg2[-1] = '=';
+           set_section_start (sec_name, optarg2);
          }
          break;
        case OPTION_TBSS: