public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: p0ulp3 <p0ulp3@gmail.com>
To: gcc-help@gcc.gnu.org, brian@dessent.net
Subject: Re: [v850] cross compiler - file v850.md
Date: Fri, 11 Apr 2008 15:02:00 -0000	[thread overview]
Message-ID: <231785cb0804110529r174c581fw6f2dc48c8be53624@mail.gmail.com> (raw)
In-Reply-To: <47FE8D1C.262ADA8A@dessent.net>

I have tried to rebuild a clean version of gcc with "make" but I am
still experiencing the same problem. By the way, one of the files
created during the installation tries to include files that don't
exist :
/tools/gnu/v850-elf/include/stdlib.h :
[...]
#include "ghs_null.h"		/* defines NULL and size_t */
#include "ghs_wchar.h"		/* defines wchar_t */
[...]

and those files are not known by google or my whole computer, even the
source of gcc, so I think that there is maybe a bug there.

I am currently using the include dir : /tools/gnu/v850-elf/include/
and I have replace the include with :
#include "null.h"
#include "wchar.h"


I have also tried this based on your remark :

$ strings /tools/gnu/lib/gcc/v850-elf/4.3.0/v850e/libgcc.a  | grep
callt | head -n100
[...]
__callt_save_interrupt
__callt_return_interrupt
__callt_save_all_interrupt
__callt_restore_all_interrupt
[...]

So you were right, the libgcc.a contains the symbols I am looking for
but they seem to be not used by ld. Actually by using the --verbose
option in the makefile, I have seen that the libgcc.a used must be
this one :

/tools/gnu/lib/gcc/v850-elf/4.3.0/libgcc.a
and both libs were installed in the same time (based on their creation time)
So I have checked this lib :
$ strings /tools/gnu/lib/gcc/v850-elf/4.3.0/libgcc.a  | grep callt
[...]
_callt_save_interrupt.o/
_callt_save_all_interrupt.o/
[...]

these are the only calls to callt_save_interrupt.o, so it's logical
that the linker doesn't find the symbols. I have then tried to rename
this lib libgcc.a.old to prevent the linker to use it, and I have
added the path for the good one in the makefile but I have an curious
error.

This is the makefile I am using :

#####
CC=/tools/gnu/bin/v850-elf-gcc.exe
CFLAGS=-mv850e -I/tools/gnu/v850-elf/include/
LDFLAGS=--verbose -Wl, -L/tools/gnu/lib/gcc/v850-elf/4.3.0/v850e/
EXEC=test
SRC= $(wildcard src/*.c)
OBJ= $(SRC:.c=.o)

all: $(EXEC)

$(EXEC): $(OBJ)
	$(CC) -o $@ $(LDFLAGS) $^

%.o: %.c
	$(CC) -o $@ -c $(CFLAGS) $<

clean:
	rm -rf src/*.o
	rm -rf *.i
	rm -rf *.s
#####

and the output when I try to include the good library :

#####
$ make -w clean && make 2>&1 | tee make.out
make: Entering directory `/home/poulpe/test_sylvain'
rm -rf src/*.o
rm -rf *.i
rm -rf *.s
make: Leaving directory `/home/poulpe/test_sylvain'
/tools/gnu/bin/v850-elf-gcc.exe -o src/Display.o -c -mv850e -I/tools/gnu/v850-el
f/include/ src/Display.c
/tools/gnu/bin/v850-elf-gcc.exe -o src/main.o -c -mv850e -I/tools/gnu/v850-elf/i
nclude/ src/main.c
src/main.c: In function 'main':
src/main.c:39: warning: return type of 'main' is not 'int'
/tools/gnu/bin/v850-elf-gcc.exe -o test --verbose -Wl, -L/tools/gnu/lib/gcc/v850
-elf/4.3.0/v850e/  src/Display.o src/main.o
Using built-in specs.
Target: v850-elf
Configured with: /tmp/src/gcc-4.3.0/configure --target=v850-elf --prefix=/tools
--exec-prefix=/tools/gnu --with-gnu-as --with-gnu-ld --with-newlib --enable-lang
uages=c,c++ -v
Thread model: single
gcc version 4.3.0 (GCC)
COMPILER_PATH=/tools/gnu/libexec/gcc/v850-elf/4.3.0/:/tools/gnu/libexec/gcc/v850
-elf/4.3.0/:/tools/gnu/libexec/gcc/v850-elf/:/tools/gnu/lib/gcc/v850-elf/4.3.0/:
/tools/gnu/lib/gcc/v850-elf/:/tools/gnu/lib/gcc/v850-elf/4.3.0/../../../../../gn
u/v850-elf/bin/
LIBRARY_PATH=/tools/gnu/lib/gcc/v850-elf/4.3.0/:/tools/gnu/lib/gcc/v850-elf/4.3.
0/../../../../../gnu/v850-elf/lib/
COLLECT_GCC_OPTIONS='-o' 'test' '-v' '-L/tools/gnu/lib/gcc/v850-elf/4.3.0/v850e/
'
 /tools/gnu/libexec/gcc/v850-elf/4.3.0/collect2.exe -o test /tools/gnu/lib/gcc/v
850-elf/4.3.0/../../../../../gnu/v850-elf/lib/crt0.o -L/tools/gnu/lib/gcc/v850-e
lf/4.3.0/v850e/ -L/tools/gnu/lib/gcc/v850-elf/4.3.0 -L/tools/gnu/lib/gcc/v850-el
f/4.3.0/../../../../../gnu/v850-elf/lib  src/Display.o src/main.o -lgcc -lc -lgc
c
/tools/gnu/lib/gcc/v850-elf/4.3.0/../../../../../gnu/v850-elf/bin/ld: : No such
file: No such file or directory
collect2: ld returned 1 exit status
make: *** [test] Error 1
#####

And the output with the bad library (no -Wl option in makefile and
libgcc.a.old renamed to libgcc.a)

#####
$ make -w clean && make 2>&1 | tee make.out
make: Entering directory `/home/sboivineau/test_sylvain'
rm -rf src/*.o
rm -rf *.i
rm -rf *.s
make: Leaving directory `/home/sboivineau/test_sylvain'
/tools/gnu/bin/v850-elf-gcc.exe -o src/Display.o -c -mv850e -I/tools/gnu/v850-el
f/include/ src/Display.c
/tools/gnu/bin/v850-elf-gcc.exe -o src/main.o -c -mv850e -I/tools/gnu/v850-elf/i
nclude/ src/main.c
src/main.c: In function 'main':
src/main.c:39: warning: return type of 'main' is not 'int'
/tools/gnu/bin/v850-elf-gcc.exe -o test --verbose  src/Display.o src/main.o
Using built-in specs.
Target: v850-elf
Configured with: /tmp/src/gcc-4.3.0/configure --target=v850-elf --prefix=/tools
--exec-prefix=/tools/gnu --with-gnu-as --with-gnu-ld --with-newlib --enable-lang
uages=c,c++ -v
Thread model: single
gcc version 4.3.0 (GCC)
COMPILER_PATH=/tools/gnu/libexec/gcc/v850-elf/4.3.0/:/tools/gnu/libexec/gcc/v850
-elf/4.3.0/:/tools/gnu/libexec/gcc/v850-elf/:/tools/gnu/lib/gcc/v850-elf/4.3.0/:
/tools/gnu/lib/gcc/v850-elf/:/tools/gnu/lib/gcc/v850-elf/4.3.0/../../../../../gn
u/v850-elf/bin/
LIBRARY_PATH=/tools/gnu/lib/gcc/v850-elf/4.3.0/:/tools/gnu/lib/gcc/v850-elf/4.3.
0/../../../../../gnu/v850-elf/lib/
COLLECT_GCC_OPTIONS='-o' 'test' '-v'
 /tools/gnu/libexec/gcc/v850-elf/4.3.0/collect2.exe -o test /tools/gnu/lib/gcc/v
850-elf/4.3.0/../../../../../gnu/v850-elf/lib/crt0.o -L/tools/gnu/lib/gcc/v850-e
lf/4.3.0 -L/tools/gnu/lib/gcc/v850-elf/4.3.0/../../../../../gnu/v850-elf/lib src
/Display.o src/main.o -lgcc -lc -lgcc
src/main.o: In function `_main':
main.c:(.text+0x10): undefined reference to `___DI'
main.c:(.text+0x2c): undefined reference to `___EI'
src/main.o: In function `_INTP4':
main.c:(.text+0x24e): undefined reference to `__callt_save_interrupt'
main.c:(.text+0x24e): relocation truncated to fit: R_V850_CALLT_6_7_OFFSET again
st undefined symbol `__callt_save_interrupt'
main.c:(.text+0x250): undefined reference to `__callt_save_all_interrupt'
main.c:(.text+0x250): relocation truncated to fit: R_V850_CALLT_6_7_OFFSET again
st undefined symbol `__callt_save_all_interrupt'
main.c:(.text+0x344): undefined reference to `__callt_restore_all_interrupt'
main.c:(.text+0x344): relocation truncated to fit: R_V850_CALLT_6_7_OFFSET again
st undefined symbol `__callt_restore_all_interrupt'
main.c:(.text+0x346): undefined reference to `__callt_return_interrupt'
main.c:(.text+0x346): relocation truncated to fit: R_V850_CALLT_6_7_OFFSET again
st undefined symbol `__callt_return_interrupt'
src/main.o: In function `_INTP5':
main.c:(.text+0x360): undefined reference to `__callt_save_interrupt'
main.c:(.text+0x360): relocation truncated to fit: R_V850_CALLT_6_7_OFFSET again
st undefined symbol `__callt_save_interrupt'
main.c:(.text+0x362): undefined reference to `__callt_save_all_interrupt'
main.c:(.text+0x362): relocation truncated to fit: R_V850_CALLT_6_7_OFFSET again
st undefined symbol `__callt_save_all_interrupt'
main.c:(.text+0x368): undefined reference to `___EI'
src/main.o: In function `_INTP9':
main.c:(.text+0x412): undefined reference to `__callt_save_interrupt'
main.c:(.text+0x412): relocation truncated to fit: R_V850_CALLT_6_7_OFFSET again
st undefined symbol `__callt_save_interrupt'
main.c:(.text+0x414): undefined reference to `__callt_save_all_interrupt'
main.c:(.text+0x414): relocation truncated to fit: R_V850_CALLT_6_7_OFFSET again
st undefined symbol `__callt_save_all_interrupt'
main.c:(.text+0x482): undefined reference to `__callt_restore_all_interrupt'
main.c:(.text+0x482): relocation truncated to fit: R_V850_CALLT_6_7_OFFSET again
st undefined symbol `__callt_restore_all_interrupt'
main.c:(.text+0x484): undefined reference to `__callt_return_interrupt'
main.c:(.text+0x484): relocation truncated to fit: R_V850_CALLT_6_7_OFFSET again
st undefined symbol `__callt_return_interrupt'
collect2: ld returned 1 exit status
make: *** [test] Error 1
#####

Thanks for your help




2008/4/10, Brian Dessent <brian@dessent.net>:
> p0ulp3 wrote:
>
>  > /tmp/src/gcc-4.3.0/configure --target=v850-elf --prefix=/tools
>  > --exec-prefix=/tools/gnu --with-gnu-as --with-gnu-ld --with-newlib -v
>  > 2>&1 | tee configure.out
>  >
>  > make -w all-gcc install-gcc LANGUAGES="c c++" 2>&1 | tee make.out
>
>
> You should really do --enable-languages=c,c++ when configuring and skip
>  overloading LANGUAGES at make time.  I think that's a gcc 3.x-ism that
>  is obsolete with the toplevel bootstrap changes in 4.x (just like "make
>  bootstrap" is now obsolete and is replaced by
>  --{enable,disable}-bootstrap.)
>
>
>  > main.c:(.text+0x24e): undefined reference to `__callt_save_interrupt'
>
>
> I suspect that this function is part of libgcc.  When you use the
>  "all-gcc" or "install-gcc" targets you tell the build system to build
>  only the bare compiler itself, not any of its supporting target
>  libraries.  So it's no surprise then that you can't link with the
>  result, because libgcc is an essential support library that gcc uses for
>  all kinds of internal functions.
>
>  This "make all-gcc" target is not supposed to make a fully working
>  compiler, it's only to be used in situations where you don't yet have
>  target libc headers and thus can't link libgcc.  You're supposed to use
>  the resulting bare gcc to then configure/build/install your libc and
>  headers, and then use those to rebuild gcc correctly and in full,
>  without the all-gcc hack.
>
>
>  > After a search, I have realized that those symbols are defined in the
>  > file v850.md but this file and the complete directory is not present
>  > on my installation. Actually I can see the directory here :
>
>
> .md files are never installed, they are source code for the compiler,
>  similar to all the other .c files.  You're chasing after the wrong thing
>  here.  You need to build libgcc, i.e. "make" not "make all-gcc".
>
>
>  Brian
>

  reply	other threads:[~2008-04-11 12:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10 17:36 p0ulp3
2008-04-11 12:14 ` Brian Dessent
2008-04-11 15:02   ` p0ulp3 [this message]
2008-04-11 23:54     ` Jim Wilson
2008-04-14 16:04       ` p0ulp3
2008-04-14 18:06         ` Jim Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=231785cb0804110529r174c581fw6f2dc48c8be53624@mail.gmail.com \
    --to=p0ulp3@gmail.com \
    --cc=brian@dessent.net \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).