Skip to contentSkip to conversation

AVR32: Change prototype of memset

PATCH New Haavard Skinnemoen 4 participants 5 messages Aug 27, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 AVR32: Change prototype of memset

[Adding u-boot-users to Cc]

Quoted 5 lines · On Mon, 20 Aug 2007 19:00:01 +0300 Semih Hazar <[email protected]> wrote:

---

The current top of the git tree doesn't compile. This patch changes the prototype according to other architectures.

Indeed. Wonder why a file compiled for the _host_ starts pulling in avr32-specific include files...

Anyway, I've applied your patch since it fixes the build. But I can't help but wonder if using target-specific headers when compiling stuff for the host is a disaster waiting to happen...

Here's the error message:

gcc -g -Wall -pedantic -idirafter /home/hskinnemoen/git/u-boot/include -idirafter /home/hskinnemoen/git/u-boot/include2 -idirafter /home/hskinnemoen/git/u-boot/include -DTEXT_BASE=0x00000000 -DUSE_HOSTCC -O -c -o sha1.o sha1.c In file included from /home/hskinnemoen/git/u-boot/include/linux/string.h:21,

                 from sha1.c:32:

/home/hskinnemoen/git/u-boot/include/asm/string.h:26: error: expected declaration specifiers or ?...? before ?size_t? sha1.c: In function ?sha1_hmac?:
sha1.c:323: error: too many arguments to function ?memset?
sha1.c:324: error: too many arguments to function ?memset?
sha1.c:344: error: too many arguments to function ?memset?
sha1.c:345: error: too many arguments to function ?memset?
sha1.c:346: error: too many arguments to function ?memset?
sha1.c:347: error: too many arguments to function ?memset?

and below is the fix. Any reason why sha1.c includes <linux/string.h> instead of just <string.h>?

Thanks for the patch!

Haavard

Quoted 15 lines
 include/asm-avr32/string.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/asm-avr32/string.h +1 -1
index 8b05d1a..58582a3 100644
@@ -23,6 +23,6 @@
 #define __ASM_AVR32_STRING_H
 
 #define __HAVE_ARCH_MEMSET
-extern void *memset(void *s, int c, size_t n);
+extern void *memset(void *s, int c, __kernel_size_t n);
 
 #endif /* __ASM_AVR32_STRING_H */
#2 lore raw

PATCH 1/1 AVR32: Change prototype of memset

Quoted 11 lines · Haavard Skinnemoen

[Adding u-boot-users to Cc]

Quoted 5 lines · On Mon, 20 Aug 2007 19:00:01 +0300 Semih Hazar <[email protected]> wrote:

---

The current top of the git tree doesn't compile. This patch changes the prototype according to other architectures.

Quoted 6 lines

Indeed. Wonder why a file compiled for the _host_ starts pulling in avr32-specific include files...

Anyway, I've applied your patch since it fixes the build. But I can't help but wonder if using target-specific headers when compiling stuff for the host is a disaster waiting to happen...

It is, Qtopia4 in Buildroot had a similar problem and crashed horribly when I tried compiling it for AVR32 arch.

<cut error message and patch>

Signature · 2 lines
With kind regards,
Hans-Christian Egtvedt, Applications Engineer
#3 lore raw

PATCH 1/1 AVR32: Change prototype of memset

In reply to Haavard Skinnemoen
Quoted 3 lines · In message <[email protected]> you wrote:

W0FkZGluZyB1LWJvb3QtdXNlcnMgdG8gQ2NdCgpPbiBNb24sIDIwIEF1ZyAyMDA3IDE5OjAwOjAx ICswMzAwClNlbWloIEhhemFyIDxzZW1paC5oYXphckBpbmRlZmlhLmNvbT4gd3JvdGU6Cgo+IFNp Z25lZC1vZmYtYnk6IFNlbWloIEhhemFyIDxzZW1paC5oYXphckBpbmRlZmlhLmNvbT4KPiAtLS0K

...

Please post plain text only.

Quoted 2 lines

and below is the fix. Any reason why sha1.c includes <linux/string.h> instead of just <string.h>?

Because there is no "include/string.h" in U-Boot.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
An Elephant is a mouse with an Operating System.              - Knuth
#4 lore raw

PATCH 1/1 AVR32: Change prototype of memset

Quoted 7 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:

W0FkZGluZyB1LWJvb3QtdXNlcnMgdG8gQ2NdCgpPbiBNb24sIDIwIEF1ZyAyMDA3IDE5OjAwOjAx ICswMzAwClNlbWloIEhhemFyIDxzZW1paC5oYXphckBpbmRlZmlhLmNvbT4gd3JvdGU6Cgo+IFNp Z25lZC1vZmYtYnk6IFNlbWloIEhhemFyIDxzZW1paC5oYXphckBpbmRlZmlhLmNvbT4KPiAtLS0K

...

Please post plain text only.

Argh...wonder how that happened. Claws Mail claims that it sent plain text, or at least something close:

Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

but after receiving it through the list, that somehow got turned into

Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64

I guess something on the way decided that quoted-printable is unacceptable and turned it into base64...

Quoted 4 lines
Quoted 2 lines

and below is the fix. Any reason why sha1.c includes <linux/string.h> instead of just <string.h>?

Because there is no "include/string.h" in U-Boot.

But there's usually a /usr/include/string.h installed with the host toolchain, no?

Haavard

#5 lore raw

PATCH 1/1 AVR32: Change prototype of memset

Quoted 8 lines · In message <[email protected]> you…
Quoted 5 lines
Quoted 3 lines

and below is the fix. Any reason why sha1.c includes <linux/string.h> instead of just <string.h>?

Because there is no "include/string.h" in U-Boot.

But there's usually a /usr/include/string.h installed with the host toolchain, no?

Sure. But sha1.c is (also) compiled and linked into the U-Boot binary, and thus it must never reference any headers from the host system.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Good manners are the settled  medium  of  social,  as  specie  is  of
commercial, life; returns are equally expected for both.
           - Lord Chesterfield _Letters to his Son_, 25 December 1753