Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/binutils/dist/gas Apply https://sourceware.org...



details:   https://anonhg.NetBSD.org/src/rev/29d77b3ccc45
branches:  trunk
changeset: 373291:29d77b3ccc45
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jan 29 23:39:12 2023 +0000

description:
Apply https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=4d74aab7aa562fe79d4669cdad0c32610531cbc0#patch1
to fix the vax issue (thanks @tsutsu for finding the patch)

diffstat:

 external/gpl3/binutils/dist/gas/app.c         |  13 +++++++++++++
 external/gpl3/binutils/dist/gas/as.h          |   1 +
 external/gpl3/binutils/dist/gas/input-scrub.c |   6 ++++--
 external/gpl3/binutils/dist/gas/macro.c       |   2 ++
 external/gpl3/binutils/dist/gas/sb.c          |   5 +++--
 5 files changed, 23 insertions(+), 4 deletions(-)

diffs (78 lines):

diff -r 6c39b5d8e776 -r 29d77b3ccc45 external/gpl3/binutils/dist/gas/app.c
--- a/external/gpl3/binutils/dist/gas/app.c     Sun Jan 29 22:12:25 2023 +0000
+++ b/external/gpl3/binutils/dist/gas/app.c     Sun Jan 29 23:39:12 2023 +0000
@@ -1537,3 +1537,16 @@
     last_char = to[-1];
   return to - tostart;
 }
+
+/* Return amount of pending input.  */
+
+size_t
+do_scrub_pending (void)
+{
+  size_t len = 0;
+  if (saved_input)
+    len += saved_input_len;
+  if (state == -1)
+    len += strlen (out_string);
+  return len;
+}
diff -r 6c39b5d8e776 -r 29d77b3ccc45 external/gpl3/binutils/dist/gas/as.h
--- a/external/gpl3/binutils/dist/gas/as.h      Sun Jan 29 22:12:25 2023 +0000
+++ b/external/gpl3/binutils/dist/gas/as.h      Sun Jan 29 23:39:12 2023 +0000
@@ -460,6 +460,7 @@
 char * input_scrub_new_file (const char *);
 char * input_scrub_next_buffer (char **bufp);
 size_t do_scrub_chars (size_t (*get) (char *, size_t), char *, size_t);
+size_t do_scrub_pending (void);
 bool   scan_for_multibyte_characters (const unsigned char *, const unsigned char *, bool);
 int    gen_to_words (LITTLENUM_TYPE *, int, long);
 int    had_err (void);
diff -r 6c39b5d8e776 -r 29d77b3ccc45 external/gpl3/binutils/dist/gas/input-scrub.c
--- a/external/gpl3/binutils/dist/gas/input-scrub.c     Sun Jan 29 22:12:25 2023 +0000
+++ b/external/gpl3/binutils/dist/gas/input-scrub.c     Sun Jan 29 23:39:12 2023 +0000
@@ -278,9 +278,11 @@
 
   next_saved_file = input_scrub_push (position);
 
-  /* Allocate sufficient space: from->len + optional newline.  */
+  /* Allocate sufficient space: from->len plus optional newline
+     plus two ".linefile " directives, plus a little more for other
+     expansion.  */
   newline = from->len >= 1 && from->ptr[0] != '\n';
-  sb_build (&from_sb, from->len + newline);
+  sb_build (&from_sb, from->len + newline + 2 * sizeof (".linefile") + 30);
   if (expansion == expanding_repeat && from_sb_expansion >= expanding_macro)
     expansion = expanding_nested;
   from_sb_expansion = expansion;
diff -r 6c39b5d8e776 -r 29d77b3ccc45 external/gpl3/binutils/dist/gas/macro.c
--- a/external/gpl3/binutils/dist/gas/macro.c   Sun Jan 29 22:12:25 2023 +0000
+++ b/external/gpl3/binutils/dist/gas/macro.c   Sun Jan 29 23:39:12 2023 +0000
@@ -1056,6 +1056,8 @@
       loclist = f;
     }
 
+  if (!err && (out->len == 0 || out->ptr[out->len - 1] != '\n'))
+    sb_add_char (out, '\n');
   return err;
 }
 
diff -r 6c39b5d8e776 -r 29d77b3ccc45 external/gpl3/binutils/dist/gas/sb.c
--- a/external/gpl3/binutils/dist/gas/sb.c      Sun Jan 29 22:12:25 2023 +0000
+++ b/external/gpl3/binutils/dist/gas/sb.c      Sun Jan 29 23:39:12 2023 +0000
@@ -119,11 +119,12 @@
      So we loop until the input S is consumed.  */
   while (1)
     {
-      size_t copy = s->len - (scrub_position - s->ptr);
+      size_t copy = s->len - (scrub_position - s->ptr) + do_scrub_pending ();
       if (copy == 0)
        break;
       sb_check (ptr, copy);
-      ptr->len += do_scrub_chars (scrub_from_sb, ptr->ptr + ptr->len, copy);
+      ptr->len += do_scrub_chars (scrub_from_sb, ptr->ptr + ptr->len,
+                                 ptr->max - ptr->len);
     }
 
   sb_to_scrub = 0;



Home | Main Index | Thread Index | Old Index