avr-gcc-list
[Top][All Lists]
Advanced

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

AW: AW: [avr-gcc-list] Linking Problems with undefined reference to '__


From: Peter Hierholzer
Subject: AW: AW: [avr-gcc-list] Linking Problems with undefined reference to '__mulhi3' when using fdevopen on atmega8
Date: Mon, 6 Oct 2003 17:46:21 +0200


> Joerg Wunsch wrote
> 
> "Peter Hierholzer" <address@hidden> wrote:
> 
> > To bypass the problem I did
> >     copy the files of C:\WinAVR\avr\lib
> >             to the directory C:\WinAVR\avr\lib\avr2
> >     copy the files from C:\WinAVR\avr\lib\avr4 to
> >             the directory C:\WinAVR\avr\lib for atmega8
> >     copy the files from C:\WinAVR\avr\lib\avr5 to
> >             the directory C:\WinAVR\avr\lib for atmega16
> 
> That's strange.  There are no avr2 subdirectories ever referenced,
> btw.  (Yes, this is ugly since it's non-orthogonal.)

I created the directory avr2 to save the content of C:\WinAVR\avr\lib.
Sorry not to be exact enough.



> I'd be surprised to hear that since it would imply that basically no
> WinAVR installation could work at all except for avr2 MCUs.
Only libc is affected, the standard library libgcc is ok. As long as there
is no multiple in the libc library everything is fine. fdevopen calls calloc
and in calloc there is a multiply. In the libc for the 8515 the multiply is
done with the __mulhi3 routine, in the libc for the atmega8 the multiply is
done by the ?mul? opcode.
 


> Are you sure you don't accidentally have an older installation of the
> compiler or binutils around?

I had WinAVR from April (WinAVR-20030424) on my disk, but deleted it before
I installed WinAVR (WinAVR-20030913-bin-install.exe). After I had the
problems I installed the April edition in addition into the directory
c:\WinAVR-20030424. 
In addition I have a CYGWIN. 
My PATH variable is
PATH=C:\WinAVR\bin;C:\WinAVR\utils\bin;C:\WINNT\system32;C:\WINNT;"C:\Progra
mme\Support Tools\";c:\cygwin\bin
c:\WinAVR                       WinAVR-20030913 files
c:\WinAVR-20030424      WinAVR-20030424 files
c:\cygwin                       cygwin files




Removing files from c:\WinAVR\avr\lib
Copying files from c:\WinAVR\avr\lib\avr2 (restoring original content)
The output of the makefile with option -v set is

C:\avr\Source\Test>make
set -e; avr-gcc -MM -v -mmcu=atmega8 -DF_MCU=16000000 -I. -g -Os
-funsigned-char -funsigned-bitfields -fpack-struct -fsh
ort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=test.lst -I.
-Ic:/avr/source/include -std=gnu99 test.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > test.d; \
[ -s test.d ] || rm -f test.d
Reading specs from c:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\specs
Configured with: ../configure --prefix=/e/avrdev/install --target=avr
--enable-languages=c,c++ --disable-nls --enable-wi
n32-registry=WinAVR
Thread model: single
gcc version 3.3.1
 c:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\cc1.exe -E -quiet -v -I. -I.
-Ic:/avr/source/include -iprefix c:\WinAVR\bin\../l
ib/gcc-lib/avr\3.3.1\ -MM -D__GNUC__=3 -D__GNUC_MINOR__=3
-D__GNUC_PATCHLEVEL__=1 -DF_MCU=16000000 test.c -mmcu=atmega8
-std=gnu99 -Wall -Wstrict-prototypes -funsigned-char -funsigned-bitfields
-fpack-struct -fshort-enums -Os
ignoring nonexistent directory "c:/WinAVR/avr/sys-include"
ignoring nonexistent directory "/e/avrdev/install/include"
ignoring nonexistent directory
"/e/avrdev/install/lib/gcc-lib/avr/3.3.1/include"
ignoring nonexistent directory "/e/avrdev/install/avr/sys-include"
ignoring nonexistent directory "/e/avrdev/install/avr/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 .
 c:/avr/source/include
 c:/WinAVR/lib/gcc-lib/avr/3.3.1/include
 c:/WinAVR/avr/include
End of search list.
make: *** Warning: File `test.d' has modification time in the future
(2003-10-06 17:28:50 > 2003-10-06 17:28:48)

-------- begin --------
avr-gcc (GCC) 3.3.1
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling: test.c
avr-gcc -c -v -mmcu=atmega8 -DF_MCU=16000000 -I. -g -Os -funsigned-char
-funsigned-bitfields -fpack-struct -fshort-enums
 -Wall -Wstrict-prototypes -Wa,-adhlns=test.lst -I. -Ic:/avr/source/include
-std=gnu99 test.c -o test.o
Reading specs from C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\specs
Configured with: ../configure --prefix=/e/avrdev/install --target=avr
--enable-languages=c,c++ --disable-nls --enable-wi
n32-registry=WinAVR
Thread model: single
gcc version 3.3.1
 C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\cc1.exe -quiet -v -I. -I.
-Ic:/avr/source/include -iprefix C:\WinAVR\bin/../lib/
gcc-lib/avr\3.3.1\ -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1
-DF_MCU=16000000 test.c -quiet -dumpbase test
.c -mmcu=atmega8 -auxbase-strip test.o -g -Os -Wall -Wstrict-prototypes
-std=gnu99 -version -funsigned-char -funsigned-b
itfields -fpack-struct -fshort-enums -o
C:\DOKUME~1\HIERHO~1.000\LOKALE~1\Temp/ccMlaaaa.s
GNU C version 3.3.1 (avr)
        compiled by GNU C version 3.2 (mingw special 20020817-1).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32702
ignoring nonexistent directory "C:/WinAVR/avr/sys-include"
ignoring nonexistent directory "/e/avrdev/install/include"
ignoring nonexistent directory
"/e/avrdev/install/lib/gcc-lib/avr/3.3.1/include"
ignoring nonexistent directory "/e/avrdev/install/avr/sys-include"
ignoring nonexistent directory "/e/avrdev/install/avr/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 .
 c:/avr/source/include
 C:/WinAVR/lib/gcc-lib/avr/3.3.1/include
 C:/WinAVR/avr/include
End of search list.
 C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\..\..\..\..\avr\bin\as.exe
--traditional-format -mmcu=atmega8 -adhlns=test.lst -
o test.o C:\DOKUME~1\HIERHO~1.000\LOKALE~1\Temp/ccMlaaaa.s

Linking: test.elf
avr-gcc -v -mmcu=atmega8 -DF_MCU=16000000 -I. -g -Os -funsigned-char
-funsigned-bitfields -fpack-struct -fshort-enums -W
all -Wstrict-prototypes -Wa,-adhlns=test.o -I. -Ic:/avr/source/include
-std=gnu99 test.o  --output test.elf -Wl,-Map=tes
t.map,--cref -Lc:/winavr/avr/lib -Lc:/avr/source/uart/
Reading specs from C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\specs
Configured with: ../configure --prefix=/e/avrdev/install --target=avr
--enable-languages=c,c++ --disable-nls --enable-wi
n32-registry=WinAVR
Thread model: single
gcc version 3.3.1
 C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\..\..\..\..\avr\bin\ld.exe -m avr4
-o test.elf C:\WinAVR\bin\..\lib\gcc-lib\avr\
3.3.1\..\..\..\..\avr\lib\avr4\crtm8.o -Lc:/winavr/avr/lib
-Lc:/avr/source/uart/ -LC:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.
1\avr4 -LC:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1
-LC:\WinAVR\bin\..\lib\gcc-lib -LC:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\
..\..\..\..\avr\lib\avr4
-LC:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\..\..\..\..\avr\lib
-LC:\WinAVR\bin\..\lib\gcc-lib\avr
\3.3.1\..\..\.. test.o -Map=test.map --cref -lgcc -lc -lgcc
c:/winavr/avr/lib\libc.a(calloc.o)(.text+0x8): In function `calloc':
: undefined reference to `__mulhi3'
make: *** [test.elf] Error 1




If I look into the map file I see that libgcc is taken from the subdirectory
avr4, and libc from the base directory

Archive member included because of file (symbol)

C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\avr4\libgcc.a(_exit.o)
                              test.o (exit)
C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\avr4\libgcc.a(_copy_data.o)
                              test.o (__do_copy_data)
C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\avr4\libgcc.a(_clear_bss.o)
                              test.o (__do_clear_bss)
c:/winavr/avr/lib\libc.a(fdevopen.o)
                              test.o (fdevopen)
c:/winavr/avr/lib\libc.a(calloc.o)
                              c:/winavr/avr/lib\libc.a(fdevopen.o) (calloc)
c:/winavr/avr/lib\libc.a(malloc.o)
                              c:/winavr/avr/lib\libc.a(calloc.o) (malloc)
c:/winavr/avr/lib\libc.a(memset.o)
                              c:/winavr/avr/lib\libc.a(calloc.o) (memset)

Allocating common symbols
Common symbol       size              file

__iob               0x6               c:/winavr/avr/lib\libc.a(fdevopen.o)

Memory Configuration

Name             Origin             Length             Attributes
text             0x00000000         0x00002000         xr
data             0x00800060         0x0000ffa0         rw !x
eeprom           0x00810000         0x00010000         rw !x
*default*        0x00000000         0xffffffff

Linker script and memory map

LOAD C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\..\..\..\..\avr\lib\avr4\crtm8.o
LOAD test.o
LOAD C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\avr4\libgcc.a
LOAD c:/winavr/avr/lib\libc.a
LOAD C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\avr4\libgcc.a

<snip....>



reply via email to

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