This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: update: building arm9 cross using crosstool


Wolcott, Ken (MED, Compuware) wrote:
It looks like I need to understand the internals of gcc. Where is a good resource (URL) where I can obtain information about the internals of gcc rather than the usage of gcc? There seems to be a request to modify the "spec" files to isolate where the gcc components are to be found (?).

There is http://gcc.gnu.org/onlinedocs/gccint/Back-End.html#Back%20End but it's not the most helpful. To modify the spec file generated by the gcc configure/install process, you'll need to edit various files in the gcc/config subdirectory. If you have trouble figuring this all out, post again with more details about the change you want to make.

Is there a nice way to add gdb to the crosstool process?

I've been meaning to do that for some time. It shouldn't be too hard. You could also try using ptxdist to build just gdb; I haven't tried that, either, but I do see their bleeding edge version in cvs claims to know how to build gdb-5.3.

Looks like I need help from the gcc and gdb mailing lists as well...

The etux and ptxdist mailing lists may also be of some help.


It would be nice if there were more documents/manuals/faqs available which describe what I'm after rather than having to "wing" everything :-)

Well, yes... but on the bright side, at least you had crosstool to start from. I still bear scars from figuring out how to build and remote test gcc and glibc... - Dan

p.s. Here's how I build gdb *without* crosstool.  You won't be able to
use it directly (you'll have to guess the values for all the IXIA_*
symbols), but it might be useful as a guide.  Compare this
with how ptxdist builds gdb to see if my kludges match theirs,
or if they have a completely different set of kludges :-)

--------------------- outermakefile.in -----------------------------
TARNAME=gdb-5.3.tar.gz
NAME=gdb-5.3


include $(CEGL_PATH)/host/bin/cegl-$(IXIA_PORTARCH)-defs.mk


IXIA_TARBALLS=$(HOME)/ixia_tarballs

HOST_DEST=$(IXIA_CROSS_TOOL)
TARGET_DEST=$(IXIA_TARGET_USR_LIB)/../bin

GSDIR=native$(IXIA_PORTARCH)/gdb/gdbserver

# FIXME: if we're building on Windows, we must be building Windows exes
# This is very wrong, but it'll solve my immediate problem...
ifeq ($(WINDIR),)
    HOST_EXEEXT=
else
    HOST_EXEEXT=.exe
endif

# Figure out target name for configure
ifeq ($(IXIA_K_ARCH),ppc)
    GDB_ARCH=powerpc-unknown-linux-gnu
endif
ifeq ($(IXIA_K_ARCH),sh)
    GDB_ARCH=sh-unknown-linux-gnu
endif
ifeq ($(IXIA_K_ARCH),i386)
    GDB_ARCH=pentium-unknown-linux-gnu
endif

all: $(IXIA_PORTARCH)/gdb/gdb$(HOST_EXEEXT) $(GSDIR)/gdbserver

install: $(HOST_DEST)gdb$(HOST_EXEEXT) $(TARGET_DEST)/gdbserver

uninstall:
        -rm -f $(HOST_DEST)gdb$(HOST_EXEEXT) $(TARGET_DEST)/gdbserver

clean:
        -rm -rf $(NAME) $(IXIA_PORTARCH) native$(IXIA_PORTARCH)

$(NAME)/configure: $(IXIA_TARBALLS)/$(TARNAME)
        tar -xzvf  $(IXIA_TARBALLS)/$(TARNAME)
        set -e; cd $(NAME); patch -b -p1 < ../solib-path.patch
        set -e; cd $(NAME)/gdb; autoheader2.13; autoconf2.13
        touch $(NAME)/configure

# Pass --enable-sim-hostendian=little to try to fix build error in sim/ppc.
# (assumes we're building on a little-endian machine.)
$(IXIA_PORTARCH)/gdb/gdb$(HOST_EXEEXT): $(NAME)/configure
        if test '!' -d $(IXIA_PORTARCH); then mkdir $(IXIA_PORTARCH); fi
        cd $(IXIA_PORTARCH); /bin/sh ../$(NAME)/configure --target=$(GDB_ARCH) --enable-sim-hostendian=little --with-solib-absolute-prefix=$(IXIA_TARGET_ROOT)
        make -C $(IXIA_PORTARCH)

# gdb build system wants gdb and gdbserver to match exactly,
# so build a native gdb for target even if we never want to run it
# just so we can get good build environment for gdbserver
# See http://www.kegel.com/linux/gdbserver.html
XENV=CC=$(IXIA_GCC3_CROSS_TOOL)gcc CFLAGS="$(IXIA_TARGET_CFLAGS)" ac_cv_func_mmap_fixed_mapped=yes

$(GSDIR)/gdbserver: $(NAME)/configure
        if test '!' -d $(GSDIR); then mkdir -p $(GSDIR); fi
        cd $(GSDIR); $(XENV) /bin/sh ../../../$(NAME)/gdb/gdbserver/configure $(GDB_ARCH)
        $(XENV) make -C $(GSDIR)

$(HOST_DEST)gdb$(HOST_EXEEXT): $(IXIA_PORTARCH)/gdb/gdb$(HOST_EXEEXT)
        if test -f $@ ; then chmod +w $@ ; fi
        cp $< $@

$(TARGET_DEST)/gdbserver: $(GSDIR)/gdbserver
        if test -f $@ ; then chmod +w $@ ; fi
        cp $< $@

--------------------- solib-path.patch -----------------------------

diff -aur src.orig/gdb/acconfig.h src/gdb/acconfig.h
--- src.orig/gdb/acconfig.h	Thu Apr 11 11:32:51 2002
+++ src/gdb/acconfig.h	Mon Jul 15 17:06:50 2002
@@ -176,3 +176,9 @@

 /* nativefile */
 #undef GDB_NM_FILE
+
+/* useful when building cross gcc for particular cross-development environment */
+#undef CONFIG_SOLIB_SEARCH_PATH
+
+/* useful when building cross gcc for particular cross-development environment */
+#undef CONFIG_SOLIB_ABSOLUTE_PREFIX
diff -aur src.orig/gdb/config.in src/gdb/config.in
--- src.orig/gdb/config.in	Fri Jun 21 16:48:32 2002
+++ src/gdb/config.in	Mon Jul 15 17:07:10 2002
@@ -1,4 +1,4 @@
-/* config.in.  Generated automatically from configure.in by autoheader.  */
+/* config.in.  Generated automatically from configure.in by autoheader 2.13.  */

 /* Define if on AIX 3.
    System headers sometimes define this.
@@ -190,6 +190,12 @@
 /* nativefile */
 #undef GDB_NM_FILE

+/* useful when building cross gcc for particular cross-development environment */
+#undef CONFIG_SOLIB_SEARCH_PATH
+
+/* useful when building cross gcc for particular cross-development environment */
+#undef CONFIG_SOLIB_ABSOLUTE_PREFIX
+
 /* Define if you have the __argz_count function.  */
 #undef HAVE___ARGZ_COUNT

diff -aur src.orig/gdb/configure.in src/gdb/configure.in
--- src.orig/gdb/configure.in	Fri Jun 21 16:48:39 2002
+++ src/gdb/configure.in	Mon Jul 15 16:32:05 2002
@@ -933,6 +933,21 @@
 ],)


+AC_ARG_WITH(solib-search-path, [ --with-solib-search-path=DIR:DIR:DIR... Directories to search for shared libraries on host], with_solib_seach_path=${withval}) + +if test x"${with_solib_seach_path}" != x ; then + AC_DEFINE_UNQUOTED(CONFIG_SOLIB_SEARCH_PATH,"$with_solib_seach_path") +fi +AC_SUBST(CONFIG_SOLIB_SEARCH_PATH) + +AC_ARG_WITH(solib-absolute-prefix, [ --with-solib-absolute-prefix=DIR Directory containing shared libraries on host], with_solib_absolute_prefix=${withval}) + +if test x"${with_solib_absolute_prefix}" != x ; then + AC_DEFINE_UNQUOTED(CONFIG_SOLIB_ABSOLUTE_PREFIX,"$with_solib_absolute_prefix") +fi +AC_SUBST(CONFIG_SOLIB_ABSOLUTE_PREFIX) + + AC_ARG_ENABLE(gdbtk, [ --enable-gdbtk Enable GDBTK GUI front end], [case "${enableval}" in diff -aur src.orig/gdb/solib.c src/gdb/solib.c --- src.orig/gdb/solib.c Sat May 11 21:20:06 2002 +++ src/gdb/solib.c Mon Jul 15 16:32:05 2002 @@ -881,4 +881,12 @@ &setlist); add_show_from_set (c, &showlist); set_cmd_completer (c, filename_completer); + +#ifdef CONFIG_SOLIB_SEARCH_PATH + solib_search_path = savestring(CONFIG_SOLIB_SEARCH_PATH, strlen(CONFIG_SOLIB_SEARCH_PATH)); +#endif +#ifdef CONFIG_SOLIB_ABSOLUTE_PREFIX + solib_absolute_prefix = savestring(CONFIG_SOLIB_ABSOLUTE_PREFIX, strlen(CONFIG_SOLIB_ABSOLUTE_PREFIX)); +#endif } +

--
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045


------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]