RE: [PATCH v9] kallsyms: Add self-test facility

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

 



From: Geert Uytterhoeven 
> Sent: 15 December 2022 13:25
...
> Looks like commit 3bc753c06dd02a35 ("kbuild: treat char as always
> unsigned") is to blame.
> 
> Changing:
> 
>     --- a/arch/m68k/include/asm/string.h
>     +++ b/arch/m68k/include/asm/string.h
>     @@ -42,7 +42,7 @@ static inline char *strncpy(char *dest, const
> char *src, size_t n)
>      #define __HAVE_ARCH_STRCMP
>      static inline int strcmp(const char *cs, const char *ct)
>      {
>     -       char res;
>     +       signed char res;
> 
>             asm ("\n"
>                     "1:     move.b  (%0)+,%2\n"     /* get *cs */
> 
> fixes strcmp, but the test still fails:

Try 'int res;' and an explicit sign extend (I think):
	"3: extb %2\n"

The strcmp() is still wrong if either input string
has characters with the top bit set.
The result needs to be based of the carry flag not
the sign of the byte subtract.

It is too long since I've written m68k asm.
I've checked, all byte operations leave the high 24bits
unchanged.
So it is possible that gcc is making assumptions and
skipping the sign extend under some circumstances.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux