[prev in list] [next in list] [prev in thread] [next in thread]
List: coreutils
Subject: Re: [PATCH] yes: fix E2K architecture compatibility
From: Pádraig_Brady <P () draigBrady ! com>
Date: 2021-09-21 15:05:28
Message-ID: 960efa6c-9cc5-c1fa-5aab-8899da0989b0 () draigBrady ! com
[Download RAW message or body]
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
["yes-e2k.patch" (text/x-patch)]
>From c3350799a83418f8357d18530ea560c1d00f2216 Mon Sep 17 00:00:00 2001
From: Mikhail Barashkov <gnu@mbarashkov.email>
Date: Tue, 21 Sep 2021 15:47:11 +0100
Subject: [PATCH] yes: fix E2K architecture compatibility
On MCST Elbrus 2000, in protected mode,
memory pointers can't be reused,
and yes crashes in protected mode.
* src/yes.c (main): Avoid reusing operands memory
in protected mode on __e2k__ architecture.
---
src/yes.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/yes.c b/src/yes.c
index b6bd35a5e..461fc6be5 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;
--
2.26.2
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic