Re: [U-Boot-Users] [PATCH] AVR32: Change prototype of memset

[Adding u-boot-users to Cc]
On Mon, 20 Aug 2007 19:00:01 +0300 Semih Hazar semih.hazar@indefia.com wrote:
Signed-off-by: Semih Hazar semih.hazar@indefia.com
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
include/asm-avr32/string.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/asm-avr32/string.h b/include/asm-avr32/string.h index 8b05d1a..58582a3 100644 --- a/include/asm-avr32/string.h +++ b/include/asm-avr32/string.h @@ -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 */

On Mon, 2007-08-27 at 15:07 +0200, Haavard Skinnemoen wrote:
[Adding u-boot-users to Cc]
On Mon, 20 Aug 2007 19:00:01 +0300 Semih Hazar semih.hazar@indefia.com wrote:
Signed-off-by: Semih Hazar semih.hazar@indefia.com
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...
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>

In message 20070827150751.109ac984@dhcp-255-175.norway.atmel.com you wrote:
W0FkZGluZyB1LWJvb3QtdXNlcnMgdG8gQ2NdCgpPbiBNb24sIDIwIEF1ZyAyMDA3IDE5OjAwOjAx ICswMzAwClNlbWloIEhhemFyIDxzZW1paC5oYXphckBpbmRlZmlhLmNvbT4gd3JvdGU6Cgo+IFNp Z25lZC1vZmYtYnk6IFNlbWloIEhhemFyIDxzZW1paC5oYXphckBpbmRlZmlhLmNvbT4KPiAtLS0K
...
Please post plain text only.
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

On 8/27/07, Wolfgang Denk wd@denx.de wrote:
In message 20070827150751.109ac984@dhcp-255-175.norway.atmel.com 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...
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

In message 1defaf580708270652j3bec3783s909fde25f9951f94@mail.gmail.com you wrote:
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
participants (4)
-
Haavard Skinnemoen
-
Hans-Christian Egtvedt
-
Håvard Skinnemoen
-
Wolfgang Denk