gas/
authorRoland McGrath <roland@gnu.org>
Tue, 29 May 2012 16:32:11 +0000 (16:32 +0000)
committerRoland McGrath <roland@gnu.org>
Tue, 29 May 2012 16:32:11 +0000 (16:32 +0000)
* read.c [HANDLE_BUNDLE] (bundle_lock_depth): New variable.
(read_a_source_file) [HANDLE_BUNDLE]: Reset it.
[HANDLE_BUNDLE] (s_bundle_lock, s_bundle_unlock): Allow nested
pairs.

gas/testsuite/
* gas/i386/bundle-bad.s: Remove nested .bundle_lock case.
* gas/i386/bundle-bad.l: Remove expected error line.
* gas/i386/bundle-lock.s: Add nested .bundle_lock case.
* gas/i386/bundle-lock.d: Update expectations.

gas/ChangeLog
gas/doc/as.texinfo
gas/read.c
gas/testsuite/ChangeLog
gas/testsuite/gas/i386/bundle-bad.l
gas/testsuite/gas/i386/bundle-bad.s
gas/testsuite/gas/i386/bundle-lock.d
gas/testsuite/gas/i386/bundle-lock.s

index a32f87c2ff1110d760071ce0dc6d92cc94760324..03424ce5b9367c589d5cb5b4c1fbbfe347d0c905 100644 (file)
@@ -1,3 +1,10 @@
+2012-05-29  Roland McGrath  <mcgrathr@google.com>
+
+       * read.c [HANDLE_BUNDLE] (bundle_lock_depth): New variable.
+       (read_a_source_file) [HANDLE_BUNDLE]: Reset it.
+       [HANDLE_BUNDLE] (s_bundle_lock, s_bundle_unlock): Allow nested
+       pairs.
+
 2012-05-28  Nick Clifton  <nickc@redhat.com>
 
        * read.c (read_symbol_name): New function.  Reads a symbol names.
index 72b5d0522f154bf73743b0b41c00dfacb5068dab..5b5d268b10c30f21f5c3eac8aa7f058b0900f591 100644 (file)
@@ -4351,9 +4351,12 @@ first instruction of the sequence so that the whole sequence starts on an
 aligned bundle boundary.  It's an error if the sequence is longer than the
 bundle size.
 
-Bundle-locked sequences do not nest.  It's an error if two
-@code{.bundle_lock} directives appear without an intervening
-@code{.bundle_unlock} directive.
+For convenience when using @code{.bundle_lock} and @code{.bundle_unlock}
+inside assembler macros (@pxref{Macro}), bundle-locked sequences may be
+nested.  That is, a second @code{.bundle_lock} directive before the next
+@code{.bundle_unlock} directive has no effect except that it must be
+matched by another closing @code{.bundle_unlock} so that there is the
+same number of @code{.bundle_lock} and @code{.bundle_unlock} directives.
 
 @node Byte
 @section @code{.byte @var{expressions}}
index cf7f7529f673650d1532a24bbf026220660a6c32..2b7f4ffef8632c386503f0d2f1ba3ad955c78bd0 100644 (file)
@@ -233,6 +233,10 @@ static unsigned int bundle_align_p2;
    we are expecting to see .bundle_unlock.  */
 static fragS *bundle_lock_frag;
 static frchainS *bundle_lock_frchain;
+
+/* This is incremented by .bundle_lock and decremented by .bundle_unlock,
+   to allow nesting.  */
+static unsigned int bundle_lock_depth;
 #endif
 
 static void do_s_func (int end_p, const char *default_prefix);
@@ -1288,6 +1292,7 @@ read_a_source_file (char *name)
                    _(".bundle_lock with no matching .bundle_unlock"));
       bundle_lock_frag = NULL;
       bundle_lock_frchain = NULL;
+      bundle_lock_depth = 0;
     }
 #endif
 
@@ -6096,14 +6101,12 @@ s_bundle_lock (int arg ATTRIBUTE_UNUSED)
       return;
     }
 
-  if (bundle_lock_frag != NULL)
+  if (bundle_lock_depth == 0)
     {
-      as_bad (_("second .bundle_lock without .bundle_unlock"));
-      return;
+      bundle_lock_frchain = frchain_now;
+      bundle_lock_frag = start_bundle ();
     }
-
-  bundle_lock_frchain = frchain_now;
-  bundle_lock_frag = start_bundle ();
+  ++bundle_lock_depth;
 }
 
 void
@@ -6121,6 +6124,10 @@ s_bundle_unlock (int arg ATTRIBUTE_UNUSED)
 
   gas_assert (bundle_align_p2 > 0);
 
+  gas_assert (bundle_lock_depth > 0);
+  if (--bundle_lock_depth > 0)
+    return;
+
   size = pending_bundle_size (bundle_lock_frag);
 
   if (size > (1U << bundle_align_p2))
index e19086abc5f07f318c05325619135201d99fbdb2..78bec37f807cd5af00ca82c30396cce1d38b1b7e 100644 (file)
@@ -1,3 +1,10 @@
+2012-05-29  Roland McGrath  <mcgrathr@google.com>
+
+       * gas/i386/bundle-bad.s: Remove nested .bundle_lock case.
+       * gas/i386/bundle-bad.l: Remove expected error line.
+       * gas/i386/bundle-lock.s: Add nested .bundle_lock case.
+       * gas/i386/bundle-lock.d: Update expectations.
+
 2012-05-28  Nick Clifton  <nickc@redhat.com>
 
        * gas/elf/syms.s: New test - checks the generation of multibyte
index ece5d7ef7b22d6e44769500bc5fa7654a7be3ec9..dd6a79398f91d7a0f613ffd799dc341d7aa5c96e 100644 (file)
@@ -7,5 +7,4 @@
 [^:]*:26:.*cannot change section or subsection inside \.bundle_lock
 [^:]*:31:.*cannot change \.bundle_align_mode inside \.bundle_lock
 [^:]*:36:.*\.bundle_unlock without preceding \.bundle_lock
-[^:]*:41:.*second \.bundle_lock without \.bundle_unlock
-[^:]*:46:.*\.bundle_lock with no matching \.bundle_unlock
+[^:]*:39:.*\.bundle_lock with no matching \.bundle_unlock
index 0974d30616d6c3977ba8c15471ddd74a9d201d03..0234ae5cdb0a0c82d2bbaca0ff47a8060770dd27 100644 (file)
        hlt
        .bundle_unlock
 
-       # Nested .bundle_lock.
-       .bundle_lock
-       clc
-       .bundle_lock
-       cld
-       .bundle_unlock
-
        # End of input with dangling .bundle_lock.
        .bundle_lock
        hlt
index afca50099a38234f6d128930e2cce67108e10131..86547e01bfdb1539185d3e65f8897b0d9ceae000 100644 (file)
@@ -3052,5 +3052,9 @@ Disassembly of section \.text:
 #...
  *bde0:\s+(f4\s+hlt|f8\s+clc)\s*
 #...
- *be00:\s+f4\s+hlt\s*
+ *be00:\s+f8\s+clc\s*
+ *be01:\s+fc\s+cld\s*
+ *be02:\s+f8\s+clc\s*
+#...
+ *be20:\s+f4\s+hlt\s*
 #pass
index 6fca9c8a2897472ff62b77e2bd20d4f01f9dfb29..af52e995a45a3b51f40a11c5d6da26454530d293 100644 (file)
@@ -89,5 +89,15 @@ sequence_\size\()_offset_\offset\():
        test_offsets 31
        test_offsets 32
 
+.p2align 5
+       # Nested .bundle_lock.
+       .bundle_lock
+       clc
+       .bundle_lock
+       cld
+       .bundle_unlock
+       clc
+       .bundle_unlock
+
 .p2align 5
        hlt
This page took 0.032621 seconds and 4 git commands to generate.