coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] yes: fix E2K architecture compatibility


From: Pádraig Brady
Subject: Re: [PATCH] yes: fix E2K architecture compatibility
Date: Tue, 21 Sep 2021 16:05:28 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0

On 21/09/2021 14:52, Mikhail Barashkov via GNU coreutils General Discussion 
wrote:
On MCST Elbrus 2000, in protected mode, memory pointers can't be reused,
and yes crashes in protected mode.

This patch fixes this by disabling reuse_operand_strings in this mode.


diff --git a/src/yes.c b/src/yes.c
index b6bd35a5e..64b40f147 100644
--- a/src/yes.c
+++ b/src/yes.c
@@ -99,6 +99,12 @@ main (int argc, char **argv)

     /* Fill the buffer with one copy of the output.  If possible, reuse
        the operands strings; this wins when the buffer would be large.  */
+  #ifdef __e2k__
+  if (sizeof(void*) == 16)
+    { // In E2K protected mode we can't reuse operands memory
+      reuse_operand_strings = false;
+    }
+  #endif
     char *buf = reuse_operand_strings ? *operands : xmalloc (bufalloc);
     size_t bufused = 0;
     operandp = operands;

This looks fine.
Please be careful with the use of non breaking space in your mailer,
as it results in patches that don't apply.
I've attached a cleaned up patch for application.

cheers,
Pádraig

Attachment: yes-e2k.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]