[Top][All Lists]

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

[avr-libc-dev] Re: avr-gcc, linker error - am i an idiot?

From: Joerg Wunsch
Subject: [avr-libc-dev] Re: avr-gcc, linker error - am i an idiot?
Date: Sun, 24 Nov 2002 10:22:29 +0100
User-agent: Mutt/1.2.5i

[I extended the audience to the avr-libc maling list.  Brian had
trouble using functions like ispunct(), getting linker errors for
things like _isprint.]

As Brian Dean wrote:

> It's in the source:
> address@hidden:/stdlib- pwd
> /usr/ports/devel/avr-libc/work/avr-libc-2002.10.02/libc/stdlib
> address@hidden:/stdlib- grep -n _isprint ctype.S
> 263:          RCALL _isprint             ; false: CLR rLow -> EQ, rLow changed

Ah, now i see what you mean.  My first test has been made against
isprint() itself which is doing fine.

This looks like a genuine bug.  Maybe someone intented to use
prepended underscores for all function names, and then hardcoded some
of them, while others are appropriately encapsulated in macros (via
FUNCTION() expanding through _U()).  They all should be made _U(name).

This raises the question again whether we generally should prepend
underscores.  Consider the following piece of code:

#include <string.h>

char r20[] = "hellö";
char r22[] = "hello";

  int i;
  i = memcmp(r20, r22, 5);
  return i;

Now see what the compiler generates out of it:

        ldi r20,lo8(5)
        ldi r21,hi8(5)
        ldi r22,lo8(r22)
        ldi r23,hi8(r22)
        ldi r24,lo8(r20)
        ldi r25,hi8(r20)
        rcall memcmp

Unlike in older versions, gas (avr-as) now seems to understand and
assemble this properly, presumably because the instruction mnemonic
implies that the second operand cannot be a register but only an
immediate value.  But it looks confusing...

I'm going to fix the _U() encapsulation in ctype.S.

cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]