This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
questions about makefiles
- From: David Byron <dbyron at coactive dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Fri, 16 Nov 2001 14:05:57 -0800
- Subject: questions about makefiles
I've been working with the 2.2.4 tarball and trying to build it on
i686-linux for an arm-linux target. The special part appears to be that my
target is big-endian, and the arm tools by default are set up for little
endian.
So, I did what I thought was the right thing and set up CFLAGS and LDFLAGS
appropriately and configured and made. To get things to build properly, I
had to change some makefiles to look at some environment variables where
they weren't before. Here are my settings:
CC=arm-linux-gcc
CFLAGS="-msoft-float -mcpu=arm9 -mbig-endian"
LDFLAGS="-Wl,-EB,-N -Wl,--oformat=\"elf32-bigarm\""
And, here are the arguments I used when configuring:
configure --target=arm-linux --host=arm-linux --with-headers=<the place
where my kernel headers live for my target> \
--prefix=<the place I want to install to, somewhere under my home
directory> \
--build=i686-pc-linux-gnu \
--disable-shared \
--disable-profile \
--without-cvs \
--enable-add-ons=linuxthreads \
--enable-static-nss \
--with-elf \
--without-gd
Rather than show you guys the diffs, I think it's easier to explain them...
- In csu/Makefile (line 132), I added $(CFLAGS) to the link-relocatable
definition. Adding $(LDFLAGS) instead works as well. Without this,
csu/crt1.o didn't link because the object files are big-endian and the
linker is trying to build something little-endian.
- added $(CFLAGS) to +prector and +postctor in Makeconfig (lines 509, 510).
Without this, iconv/iconvconfig failed to link because the crtbegin.o and
crtend.o being picked up were little endian and the other object files are
big-endian.
- added $(CFLAGS) to +link and +link-static in Makeconfig (lines 385, 397).
Without this, -lgcc indicates the little endian libgcc.a when linking
iconv/iconvconfig (+link) and elf/sln (+link-static). $(LDFLAGS) is already
passed to $(CC) here, but I'm not sure how to can change it to make this
work for me. (How come iconv/iconvconfig is linked with +link instead of
+link-static when I specified --disable-shared?)
- added $(ASFLAGS) to Makerules (lines 315, 317). This one confused me.
Even after making CPPFLAGS=$CFLAGS and exporting it as I do for the other
variables, it doesn't seem like Makerules picks it up. But, if I use
ASFLAGS=$CFLAGS, it works fine. In other words:
CPPFLAGS=-msoft-float -mcpu=arm9 -mbig-endian make
doesn't work
but after changing Makerules,
ASFLAGS=-msoft-float -mcpu=arm9 -mbig-endian make
does. I'm pretty sure there's a better fix than this one for this problem.
Without a change like this, assembly files get built for little-endian, and
the links fail. Perhaps line 625 of Makeconfig is the line that needs to
change to take CPPFLAGS from the outside world.
As a caveat, a hello world program working based on the glibc I built with
these changes doesn't work, but if folks can confirm that I did the right
thing (or a right thing) here, it would help a lot.
I'm pretty new to glibc, so I don't know if this is the way the owner would
have changed the makefiles. If not, can someone suggest another solution?
I looked in cvs, and changes like this don't seem to have been made since
2.2.4.
Thanks much for your help.
-DB
---
David Byron dbyron@coactive.com
Coactive Networks, Inc. http://www.coactive.com
28 Liberty Ship Way voice:(415)289-7800
Sausalito, CA 94965 fax:(415)289-1320