]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ld/ChangeLog
authorDave Korn <dave.korn@artimi.com>
Wed, 27 May 2009 18:40:56 +0000 (18:40 +0000)
committerDave Korn <dave.korn@artimi.com>
Wed, 27 May 2009 18:40:56 +0000 (18:40 +0000)
* deffilep.y (%union):  Add new string-type semantic value 'digits'.
(%token):  Remove NUMBER as token, add DIGITS.
(%type):  Add NUMBER as type.  Add new id types anylang_id, opt_id.
(ALIGNCOMM):  Parse an anylang_id instead of a plain ID.
(anylang_id):  New production.
(opt_digits):  Likewise.
(opt_id):  Likewise.
(NUMBER):  Likewise.
(def_lex):  Return strings of digits in raw string form as DIGITS
token, instead of converting to numeric integer type.

ld/testsuite/ChangeLog

* ld-pe/non-c-lang-syms.c:  New dump test source file.
* ld-pe/non-c-lang-syms.d:  New dump test pattern file.
* ld-pe/pe.exp:  Run new "foreign symbol" test.

ld/ChangeLog
ld/deffilep.y
ld/testsuite/ChangeLog
ld/testsuite/ld-pe/non-c-lang-syms.d [new file with mode: 0755]
ld/testsuite/ld-pe/non-c-lang-syms.s [new file with mode: 0755]
ld/testsuite/ld-pe/pe.exp

index 9c02e69ea22360ff1e884542f4ee12b292477116..9c4b545792cc6f78247b6dd3329c8f1b290191c0 100644 (file)
@@ -1,3 +1,16 @@
+2009-05-27  Dave Korn  <dave.korn.cygwin@gmail.com>
+
+       * deffilep.y (%union):  Add new string-type semantic value 'digits'.
+       (%token):  Remove NUMBER as token, add DIGITS.
+       (%type):  Add NUMBER as type.  Add new id types anylang_id, opt_id.
+       (ALIGNCOMM):  Parse an anylang_id instead of a plain ID.
+       (anylang_id):  New production.
+       (opt_digits):  Likewise.
+       (opt_id):  Likewise.
+       (NUMBER):  Likewise.
+       (def_lex):  Return strings of digits in raw string form as DIGITS
+       token, instead of converting to numeric integer type.
+
 2009-05-26  Nathan Sidwell  <nathan@codesourcery.com>
 
        * ldmain.c (main): Don't reject --relax -r.
index 5f02727bdf6a9395930f77acb43b2e3e8db521b0..83872f5981be3fb4671a1fa9d74cd61ed1fd3181 100644 (file)
@@ -103,6 +103,7 @@ static const char *lex_parse_string_end = 0;
 %union {
   char *id;
   int number;
+  char *digits;
 };
 
 %token NAME LIBRARY DESCRIPTION STACKSIZE_K HEAPSIZE CODE DATAU DATAL
@@ -110,10 +111,12 @@ static const char *lex_parse_string_end = 0;
 %token PRIVATEU PRIVATEL ALIGNCOMM
 %token READ WRITE EXECUTE SHARED NONAMEU NONAMEL DIRECTIVE
 %token <id> ID
-%token <number> NUMBER
+%token <digits> DIGITS
+%type  <number> NUMBER
+%type  <digits> opt_digits
 %type  <number> opt_base opt_ordinal
 %type  <number> attr attr_list opt_number exp_opt_list exp_opt
-%type  <id> opt_name opt_equal_name dot_name 
+%type  <id> opt_name opt_equal_name dot_name anylang_id opt_id
 
 %%
 
@@ -135,7 +138,7 @@ command:
        |       VERSIONK NUMBER { def_version ($2, 0);}
        |       VERSIONK NUMBER '.' NUMBER { def_version ($2, $4);}
        |       DIRECTIVE ID { def_directive ($2);}
-       |       ALIGNCOMM ID ',' NUMBER { def_aligncomm ($2, $4);}
+       |       ALIGNCOMM anylang_id ',' NUMBER { def_aligncomm ($2, $4);}
        ;
 
 
@@ -245,7 +248,25 @@ dot_name: ID               { $$ = $1; }
            $$ = name;
          }
        ;
-       
+
+anylang_id: ID         { $$ = $1; }
+       | anylang_id '.' opt_digits opt_id
+         {
+           char *id = xmalloc (strlen ($1) + 1 + strlen ($3) + strlen ($4) + 1);
+           sprintf (id, "%s.%s%s", $1, $3, $4);
+           $$ = id;
+         }
+       ;
+
+opt_digits: DIGITS     { $$ = $1; }
+       |               { $$ = ""; }
+       ;
+
+opt_id: ID             { $$ = $1; }
+       |               { $$ = ""; }
+       ;
+
+NUMBER: DIGITS         { $$ = strtoul ($1, 0, 0); }
 
 %%
 
@@ -1010,11 +1031,11 @@ def_lex (void)
        }
       if (c != EOF)
        def_ungetc (c);
-      yylval.number = strtoul (buffer, 0, 0);
+      yylval.digits = xstrdup (buffer);
 #if TRACE
-      printf ("lex: `%s' returns NUMBER %d\n", buffer, yylval.number);
+      printf ("lex: `%s' returns DIGITS\n", buffer);
 #endif
-      return NUMBER;
+      return DIGITS;
     }
 
   if (ISALPHA (c) || strchr ("$:-_?@", c))
index 9d54d034df06aea7b77ca8014593bc551723625f..e6a02b0b2eb4b25bf09341531b98795d419cb335 100644 (file)
@@ -1,3 +1,9 @@
+2009-05-27  Dave Korn  <dave.korn.cygwin@gmail.com>
+
+       * ld-pe/non-c-lang-syms.c:  New dump test source file.
+       * ld-pe/non-c-lang-syms.d:  New dump test pattern file.
+       * ld-pe/pe.exp:  Run new "foreign symbol" test.
+
 2009-05-26  Nathan Sidwell  <nathan@codesourcery.com>
 
        * ld-powerpc/vxworks-relax-2.s: New.
diff --git a/ld/testsuite/ld-pe/non-c-lang-syms.d b/ld/testsuite/ld-pe/non-c-lang-syms.d
new file mode 100755 (executable)
index 0000000..3c7fa93
--- /dev/null
@@ -0,0 +1,10 @@
+#...
+[0-9A-Fa-f]{6,14}[08]0 B _?test\$equiv\.eq\.
+[0-9A-Fa-f]{6,14}[02468aAcCeE]0 B _?test\$equiv\.eq\.100
+[0-9A-Fa-f]{6,14}[0-9A-Fa-f]0 B _?test\$equiv\.eq\.1_
+[0-9A-Fa-f]{6,14}[048cC]0 B _?test\$equiv\.eq\._
+[0-9A-Fa-f]{6,14}[08]0 B _?test_equiv\.eq\.
+[0-9A-Fa-f]{6,14}[02468aAcCeE]0 B _?test_equiv\.eq\.100
+[0-9A-Fa-f]{6,14}[0-9A-Fa-f]0 B _?test_equiv\.eq\.1_
+[0-9A-Fa-f]{6,14}[048cC]0 B _?test_equiv\.eq\._
+#...
diff --git a/ld/testsuite/ld-pe/non-c-lang-syms.s b/ld/testsuite/ld-pe/non-c-lang-syms.s
new file mode 100755 (executable)
index 0000000..e849d9e
--- /dev/null
@@ -0,0 +1,15 @@
+
+main:
+_main:
+       nop
+
+       .comm   _test_equiv.eq.1_, 16, 4
+       .comm   _test_equiv.eq.100, 16, 5
+       .comm   _test_equiv.eq._, 16, 6
+       .comm   _test_equiv.eq., 16, 7
+
+       .comm   _test$equiv.eq.1_, 16, 4
+       .comm   _test$equiv.eq.100, 16, 5
+       .comm   _test$equiv.eq._, 16, 6
+       .comm   _test$equiv.eq., 16, 7
+
index 3fcf8cbf48b2dd6300d4f26877ba36ee816d4334..648e9a0142a80a52d8e7e7ef1f9d775577cb8055 100644 (file)
@@ -69,3 +69,10 @@ run_dump_test "longsecn-4"
 run_dump_test "longsecn-5"
 
 run_dump_test "orphan"
+
+set foreign_sym_test {
+  {"non-C aligned common" "" "" {non-c-lang-syms.s}
+   {{nm -C non-c-lang-syms.d}} "non-c-lang-syms.x"}
+}
+
+run_ld_link_tests $foreign_sym_test