public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Sim bfin build failure with gcc 11
@ 2021-05-24  0:51 Simon Marchi
  2021-05-24  1:37 ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Marchi @ 2021-05-24  0:51 UTC (permalink / raw)
  To: gdb-patches

I see this with gcc 11:

$ ccache gcc  -DHAVE_CONFIG_H -DWITH_DEFAULT_MODEL='"bf537"' -DWITH_DEFAULT_ALIGNMENT=STRICT_ALIGNMENT  -DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE  -DWITH_HW=1 -DDEFAULT_INLINE=0   -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Werror  -I. -I/home/simark/src/binutils-gdb/sim/bfin -I../common -I/home/simark/src/binutils-gdb/sim/bfin/../common -I../../include -I/home/simark/src/binutils-gdb/sim/bfin/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/bfin/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/bfin/../../opcodes  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  -DHAVE_SDL -g3 -O0 -fsanitize=address -fmax-errors=1     -c -o dv-bfin_otp.o -MT dv-bfin_otp.o -MMD -MP -MF .deps/dv-bfin_otp.Tpo /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c
/home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c: In function ‘bfin_otp_write_page’:
/home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:94:3: error: ‘bfin_otp_write_page_val’ accessing 16 bytes in a region of size 4 [-Werror=stringop-overflow=]
   94 |   bfin_otp_write_page_val (otp, page, (void *)&otp->data0);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:94:3: note: referencing argument 3 of type ‘bu64 *’ {aka ‘long unsigned int *’}
/home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:81:1: note: in a call to function ‘bfin_otp_write_page_val’
   81 | bfin_otp_write_page_val (struct bfin_otp *otp, bu16 page, bu64 val[2])
      | ^~~~~~~~~~~~~~~~~~~~~~~

It's not immediately obvious to me why it says that.

Simon

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sim bfin build failure with gcc 11
  2021-05-24  0:51 Sim bfin build failure with gcc 11 Simon Marchi
@ 2021-05-24  1:37 ` Mike Frysinger
  2021-05-24  1:41   ` Simon Marchi
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2021-05-24  1:37 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

On 23 May 2021 20:51, Simon Marchi via Gdb-patches wrote:
> I see this with gcc 11:
> 
> $ ccache gcc  -DHAVE_CONFIG_H -DWITH_DEFAULT_MODEL='"bf537"' -DWITH_DEFAULT_ALIGNMENT=STRICT_ALIGNMENT  -DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE  -DWITH_HW=1 -DDEFAULT_INLINE=0   -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Werror  -I. -I/home/simark/src/binutils-gdb/sim/bfin -I../common -I/home/simark/src/binutils-gdb/sim/bfin/../common -I../../include -I/home/simark/src/binutils-gdb/sim/bfin/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/bfin/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/bfin/../../opcodes  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  -DHAVE_SDL -g3 -O0 -fsanitize=address -fmax-errors=1     -c -o dv-bfin_otp.o -MT dv-bfin_otp.o -MMD -MP -MF .deps/dv-bfin_otp.Tpo /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c
> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c: In function ‘bfin_otp_write_page’:
> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:94:3: error: ‘bfin_otp_write_page_val’ accessing 16 bytes in a region of size 4 [-Werror=stringop-overflow=]
>    94 |   bfin_otp_write_page_val (otp, page, (void *)&otp->data0);
>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:94:3: note: referencing argument 3 of type ‘bu64 *’ {aka ‘long unsigned int *’}
> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:81:1: note: in a call to function ‘bfin_otp_write_page_val’
>    81 | bfin_otp_write_page_val (struct bfin_otp *otp, bu16 page, bu64 val[2])
>       | ^~~~~~~~~~~~~~~~~~~~~~~
> 
> It's not immediately obvious to me why it says that.

gcc really wants its pointer types to be in harmony.  i cheated here.

write_page_val wants a pointer to an array of 2 64-bit values.  i know the
otp struct has "bu64 data0, data1, data2, data3;", and taking the address
of data0 has the same memory layout as if it were "bu64 data[3];".  but with
the fortify work gcc has long been doing, they've stopped accepting these
kinds of hacks.

this code is not perf sensitive, so i can be less "clever" while keeping the
compiler happy.
-mike

commit 3cc4ee83adf2f6e2ab21e32f7d5942b1d1803a04
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sun May 23 21:35:32 2021 -0400

    sim: bfin: fix build warnings w/newer gcc
    
    The bfin_otp_write_page_val func wants a pointer to an bu64[2] array,
    but this code passes it a pointer to a single bu64.  It's in a struct
    with a known compatible layout:
            bu64 data0, data1, data2, data3;
    But gcc doesn't allow these kinds of tricks anymore.  Use the more
    verbose form to make the compiler happy since this is not performance
    sensitive code.

diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 1ebf6818ac77..9c517d20bbeb 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-bfin_otp.c (bfin_otp_write_page): Call bfin_otp_write_page_val2.
+
 2021-05-23  Mike Frysinger  <vapier@gentoo.org>
 
 	* dv-bfin_cec.c: Include strings.h.
diff --git a/sim/bfin/dv-bfin_otp.c b/sim/bfin/dv-bfin_otp.c
index 6cf1c8155c62..65afdf58b27f 100644
--- a/sim/bfin/dv-bfin_otp.c
+++ b/sim/bfin/dv-bfin_otp.c
@@ -91,7 +91,7 @@ bfin_otp_write_page_val2 (struct bfin_otp *otp, bu16 page, bu64 lo, bu64 hi)
 static void
 bfin_otp_write_page (struct bfin_otp *otp, bu16 page)
 {
-  bfin_otp_write_page_val (otp, page, (void *)&otp->data0);
+  bfin_otp_write_page_val2 (otp, page, otp->data0, otp->data1);
 }
 
 static unsigned

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sim bfin build failure with gcc 11
  2021-05-24  1:37 ` Mike Frysinger
@ 2021-05-24  1:41   ` Simon Marchi
  2021-05-24  2:16     ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Marchi @ 2021-05-24  1:41 UTC (permalink / raw)
  To: gdb-patches



On 2021-05-23 9:37 p.m., Mike Frysinger wrote:
> On 23 May 2021 20:51, Simon Marchi via Gdb-patches wrote:
>> I see this with gcc 11:
>>
>> $ ccache gcc  -DHAVE_CONFIG_H -DWITH_DEFAULT_MODEL='"bf537"' -DWITH_DEFAULT_ALIGNMENT=STRICT_ALIGNMENT  -DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE  -DWITH_HW=1 -DDEFAULT_INLINE=0   -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Werror  -I. -I/home/simark/src/binutils-gdb/sim/bfin -I../common -I/home/simark/src/binutils-gdb/sim/bfin/../common -I../../include -I/home/simark/src/binutils-gdb/sim/bfin/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/bfin/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/bfin/../../opcodes  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  -DHAVE_SDL -g3 -O0 -fsanitize=address -fmax-errors=1     -c -o dv-bfin_otp.o -MT dv-bfin_otp.o -MMD -MP -MF .deps/dv-bfin_otp.Tpo /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c
>> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c: In function ‘bfin_otp_write_page’:
>> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:94:3: error: ‘bfin_otp_write_page_val’ accessing 16 bytes in a region of size 4 [-Werror=stringop-overflow=]
>>    94 |   bfin_otp_write_page_val (otp, page, (void *)&otp->data0);
>>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:94:3: note: referencing argument 3 of type ‘bu64 *’ {aka ‘long unsigned int *’}
>> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:81:1: note: in a call to function ‘bfin_otp_write_page_val’
>>    81 | bfin_otp_write_page_val (struct bfin_otp *otp, bu16 page, bu64 val[2])
>>       | ^~~~~~~~~~~~~~~~~~~~~~~
>>
>> It's not immediately obvious to me why it says that.
> 
> gcc really wants its pointer types to be in harmony.  i cheated here.
> 
> write_page_val wants a pointer to an array of 2 64-bit values.  i know the
> otp struct has "bu64 data0, data1, data2, data3;", and taking the address
> of data0 has the same memory layout as if it were "bu64 data[3];".  but with
> the fortify work gcc has long been doing, they've stopped accepting these
> kinds of hacks.
> 
> this code is not perf sensitive, so i can be less "clever" while keeping the
> compiler happy.
> -mike

Ah, I see.  Well if what you want is make sure the fields are
contiguous, why not make that an array of four bu32 instead?

Simon

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sim bfin build failure with gcc 11
  2021-05-24  1:41   ` Simon Marchi
@ 2021-05-24  2:16     ` Mike Frysinger
  2021-05-29  1:52       ` Simon Marchi
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2021-05-24  2:16 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

On 23 May 2021 21:41, Simon Marchi via Gdb-patches wrote:
> On 2021-05-23 9:37 p.m., Mike Frysinger wrote:
> > On 23 May 2021 20:51, Simon Marchi via Gdb-patches wrote:
> >> I see this with gcc 11:
> >>
> >> $ ccache gcc  -DHAVE_CONFIG_H -DWITH_DEFAULT_MODEL='"bf537"' -DWITH_DEFAULT_ALIGNMENT=STRICT_ALIGNMENT  -DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE  -DWITH_HW=1 -DDEFAULT_INLINE=0   -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Werror  -I. -I/home/simark/src/binutils-gdb/sim/bfin -I../common -I/home/simark/src/binutils-gdb/sim/bfin/../common -I../../include -I/home/simark/src/binutils-gdb/sim/bfin/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/bfin/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/bfin/../../opcodes  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  -DHAVE_SDL -g3 -O0 -fsanitize=address -fmax-errors=1     -c -o dv-bfin_otp.o -MT dv-bfin_otp.o -MMD -MP -MF .deps/dv-bfin_otp.Tpo /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c
> >> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c: In function ‘bfin_otp_write_page’:
> >> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:94:3: error: ‘bfin_otp_write_page_val’ accessing 16 bytes in a region of size 4 [-Werror=stringop-overflow=]
> >>    94 |   bfin_otp_write_page_val (otp, page, (void *)&otp->data0);
> >>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:94:3: note: referencing argument 3 of type ‘bu64 *’ {aka ‘long unsigned int *’}
> >> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:81:1: note: in a call to function ‘bfin_otp_write_page_val’
> >>    81 | bfin_otp_write_page_val (struct bfin_otp *otp, bu16 page, bu64 val[2])
> >>       | ^~~~~~~~~~~~~~~~~~~~~~~
> >>
> >> It's not immediately obvious to me why it says that.
> > 
> > gcc really wants its pointer types to be in harmony.  i cheated here.
> > 
> > write_page_val wants a pointer to an array of 2 64-bit values.  i know the
> > otp struct has "bu64 data0, data1, data2, data3;", and taking the address
> > of data0 has the same memory layout as if it were "bu64 data[3];".  but with
> > the fortify work gcc has long been doing, they've stopped accepting these
> > kinds of hacks.
> > 
> > this code is not perf sensitive, so i can be less "clever" while keeping the
> > compiler happy.
> 
> Ah, I see.  Well if what you want is make sure the fields are
> contiguous, why not make that an array of four bu32 instead?

i'm not worried about the ordering ... it's a struct, so that's guaranteed.
the code uses a style to make it easy to compare against the datasheets and
to make it easy to access individual fields.  the datasheets have "DATA0"
an "DATA1" and such as explicit MMRs, not DATA[3].

but i misread the code and thought it said bu64 data0... when it's really
bu32 as you point out.  which is why i was being clever in the first place,
and the patch i just pushed is incorrect.

i guess the existing code was assuming the host cpu was little endian, so
doing a manual construction of the 64bit fields is unavoidable.  so let's
try this again.
-mike

commit d699be882b42f36677836c320edbf7db24021a30
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sun May 23 22:15:01 2021 -0400

    sim: bfin: fix the otp fix
    
    I misread the code and thought data0/... were bu64 when they were
    actually bu32.  Fix the call to assemble the 2 64-bit values instead
    of passing the 2 halves of the first 64-bit value.

diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 9c517d20bbeb..29dfde8fe6e3 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-23  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-bfin_otp.c (bfin_otp_write_page): Fix args to
+	bfin_otp_write_page_val2.
+
 2021-05-23  Mike Frysinger  <vapier@gentoo.org>
 
 	* dv-bfin_otp.c (bfin_otp_write_page): Call bfin_otp_write_page_val2.
diff --git a/sim/bfin/dv-bfin_otp.c b/sim/bfin/dv-bfin_otp.c
index 65afdf58b27f..cdc010ae551b 100644
--- a/sim/bfin/dv-bfin_otp.c
+++ b/sim/bfin/dv-bfin_otp.c
@@ -91,7 +91,8 @@ bfin_otp_write_page_val2 (struct bfin_otp *otp, bu16 page, bu64 lo, bu64 hi)
 static void
 bfin_otp_write_page (struct bfin_otp *otp, bu16 page)
 {
-  bfin_otp_write_page_val2 (otp, page, otp->data0, otp->data1);
+  bfin_otp_write_page_val2 (otp, page, (bu64)otp->data1 | otp->data0,
+			    (bu64)otp->data3 | otp->data2);
 }
 
 static unsigned

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sim bfin build failure with gcc 11
  2021-05-24  2:16     ` Mike Frysinger
@ 2021-05-29  1:52       ` Simon Marchi
  2021-05-29  3:32         ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Marchi @ 2021-05-29  1:52 UTC (permalink / raw)
  To: gdb-patches



On 2021-05-23 10:16 p.m., Mike Frysinger wrote:
> On 23 May 2021 21:41, Simon Marchi via Gdb-patches wrote:
>> On 2021-05-23 9:37 p.m., Mike Frysinger wrote:
>>> On 23 May 2021 20:51, Simon Marchi via Gdb-patches wrote:
>>>> I see this with gcc 11:
>>>>
>>>> $ ccache gcc  -DHAVE_CONFIG_H -DWITH_DEFAULT_MODEL='"bf537"' -DWITH_DEFAULT_ALIGNMENT=STRICT_ALIGNMENT  -DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE  -DWITH_HW=1 -DDEFAULT_INLINE=0   -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Werror  -I. -I/home/simark/src/binutils-gdb/sim/bfin -I../common -I/home/simark/src/binutils-gdb/sim/bfin/../common -I../../include -I/home/simark/src/binutils-gdb/sim/bfin/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/bfin/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/bfin/../../opcodes  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  -DHAVE_SDL -g3 -O0 -fsanitize=address -fmax-errors=1     -c -o dv-bfin_otp.o -MT dv-bfin_otp.o -MMD -MP -MF .deps/dv-bfin_otp.Tpo /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c
>>>> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c: In function ‘bfin_otp_write_page’:
>>>> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:94:3: error: ‘bfin_otp_write_page_val’ accessing 16 bytes in a region of size 4 [-Werror=stringop-overflow=]
>>>>    94 |   bfin_otp_write_page_val (otp, page, (void *)&otp->data0);
>>>>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:94:3: note: referencing argument 3 of type ‘bu64 *’ {aka ‘long unsigned int *’}
>>>> /home/simark/src/binutils-gdb/sim/bfin/dv-bfin_otp.c:81:1: note: in a call to function ‘bfin_otp_write_page_val’
>>>>    81 | bfin_otp_write_page_val (struct bfin_otp *otp, bu16 page, bu64 val[2])
>>>>       | ^~~~~~~~~~~~~~~~~~~~~~~
>>>>
>>>> It's not immediately obvious to me why it says that.
>>>
>>> gcc really wants its pointer types to be in harmony.  i cheated here.
>>>
>>> write_page_val wants a pointer to an array of 2 64-bit values.  i know the
>>> otp struct has "bu64 data0, data1, data2, data3;", and taking the address
>>> of data0 has the same memory layout as if it were "bu64 data[3];".  but with
>>> the fortify work gcc has long been doing, they've stopped accepting these
>>> kinds of hacks.
>>>
>>> this code is not perf sensitive, so i can be less "clever" while keeping the
>>> compiler happy.
>>
>> Ah, I see.  Well if what you want is make sure the fields are
>> contiguous, why not make that an array of four bu32 instead?
> 
> i'm not worried about the ordering ... it's a struct, so that's guaranteed.
> the code uses a style to make it easy to compare against the datasheets and
> to make it easy to access individual fields.  the datasheets have "DATA0"
> an "DATA1" and such as explicit MMRs, not DATA[3].
> 
> but i misread the code and thought it said bu64 data0... when it's really
> bu32 as you point out.  which is why i was being clever in the first place,
> and the patch i just pushed is incorrect.
> 
> i guess the existing code was assuming the host cpu was little endian, so
> doing a manual construction of the 64bit fields is unavoidable.  so let's
> try this again.
> -mike
> 
> commit d699be882b42f36677836c320edbf7db24021a30
> Author: Mike Frysinger <vapier@gentoo.org>
> Date:   Sun May 23 22:15:01 2021 -0400
> 
>     sim: bfin: fix the otp fix
>     
>     I misread the code and thought data0/... were bu64 when they were
>     actually bu32.  Fix the call to assemble the 2 64-bit values instead
>     of passing the 2 halves of the first 64-bit value.
> 
> diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
> index 9c517d20bbeb..29dfde8fe6e3 100644
> --- a/sim/bfin/ChangeLog
> +++ b/sim/bfin/ChangeLog
> @@ -1,3 +1,8 @@
> +2021-05-23  Mike Frysinger  <vapier@gentoo.org>
> +
> +	* dv-bfin_otp.c (bfin_otp_write_page): Fix args to
> +	bfin_otp_write_page_val2.
> +
>  2021-05-23  Mike Frysinger  <vapier@gentoo.org>
>  
>  	* dv-bfin_otp.c (bfin_otp_write_page): Call bfin_otp_write_page_val2.
> diff --git a/sim/bfin/dv-bfin_otp.c b/sim/bfin/dv-bfin_otp.c
> index 65afdf58b27f..cdc010ae551b 100644
> --- a/sim/bfin/dv-bfin_otp.c
> +++ b/sim/bfin/dv-bfin_otp.c
> @@ -91,7 +91,8 @@ bfin_otp_write_page_val2 (struct bfin_otp *otp, bu16 page, bu64 lo, bu64 hi)
>  static void
>  bfin_otp_write_page (struct bfin_otp *otp, bu16 page)
>  {
> -  bfin_otp_write_page_val2 (otp, page, otp->data0, otp->data1);
> +  bfin_otp_write_page_val2 (otp, page, (bu64)otp->data1 | otp->data0,
> +			    (bu64)otp->data3 | otp->data2);

I really don't know what this is doing but... did you mean to have some
shifts in there?

Simon


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Sim bfin build failure with gcc 11
  2021-05-29  1:52       ` Simon Marchi
@ 2021-05-29  3:32         ` Mike Frysinger
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2021-05-29  3:32 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

On 28 May 2021 21:52, Simon Marchi via Gdb-patches wrote:
> On 2021-05-23 10:16 p.m., Mike Frysinger wrote:
> >  static void
> >  bfin_otp_write_page (struct bfin_otp *otp, bu16 page)
> >  {
> > -  bfin_otp_write_page_val2 (otp, page, otp->data0, otp->data1);
> > +  bfin_otp_write_page_val2 (otp, page, (bu64)otp->data1 | otp->data0,
> > +			    (bu64)otp->data3 | otp->data2);
> 
> I really don't know what this is doing but... did you mean to have some
> shifts in there?

err, yeah.  thanks.
-mike

commit f006d9e205f729aad48c0876eb8cd8feb70a6972
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Fri May 28 23:29:40 2021 -0400

    sim: bfin: fix the otp fix fix
    
    Need to shift the upper 32-bits and not just combine directly with
    the lower 32-bits.

diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 29dfde8fe6e3..e5b644990947 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-28  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-bfin_otp.c (bfin_otp_write_page): Shift data1 & data3 by 32-bits.
+
 2021-05-23  Mike Frysinger  <vapier@gentoo.org>
 
 	* dv-bfin_otp.c (bfin_otp_write_page): Fix args to
diff --git a/sim/bfin/dv-bfin_otp.c b/sim/bfin/dv-bfin_otp.c
index cdc010ae551b..a9f768d0c0ea 100644
--- a/sim/bfin/dv-bfin_otp.c
+++ b/sim/bfin/dv-bfin_otp.c
@@ -91,8 +91,8 @@ bfin_otp_write_page_val2 (struct bfin_otp *otp, bu16 page, bu64 lo, bu64 hi)
 static void
 bfin_otp_write_page (struct bfin_otp *otp, bu16 page)
 {
-  bfin_otp_write_page_val2 (otp, page, (bu64)otp->data1 | otp->data0,
-			    (bu64)otp->data3 | otp->data2);
+  bfin_otp_write_page_val2 (otp, page, ((bu64)otp->data1 << 32) | otp->data0,
+			    ((bu64)otp->data3 << 32) | otp->data2);
 }
 
 static unsigned

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-29  3:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  0:51 Sim bfin build failure with gcc 11 Simon Marchi
2021-05-24  1:37 ` Mike Frysinger
2021-05-24  1:41   ` Simon Marchi
2021-05-24  2:16     ` Mike Frysinger
2021-05-29  1:52       ` Simon Marchi
2021-05-29  3:32         ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).