* [Buildroot] [PATCH 1/1] gcc: fix libstdc++_pic for AVR32
@ 2013-08-09 5:16 Alexander Lukichev
2013-08-10 19:06 ` Thomas Petazzoni
2013-08-23 4:59 ` Thomas Petazzoni
0 siblings, 2 replies; 6+ messages in thread
From: Alexander Lukichev @ 2013-08-09 5:16 UTC (permalink / raw)
To: buildroot
It is not clear why 300-libstdc++-pic.patch pre-applied to
gcc-4.2.2-avr32-2.1.5 seems to have come from some older version
of gcc (as early as 4.0.3). This older patch incorrectly refers to
object files to be included in the library libstdc++_pic.a as *.o,
while their location seems to be in .libs/*.o (see the contents at
e.g. https://github.com/ZigFisher/Midge/blob/master/toolchain/gcc/4.0.3/300-libstdc%2B%2B-pic.patch ).
The same patch for gcc 4.1.0 refers to the files as .libs/*.o (see
https://github.com/ZigFisher/Midge/blob/master/toolchain/gcc/4.1.0/300-libstdc%2B%2B-pic.patch ).
This patch corrects rules in Makefile.in.
Signed-off-by: Alexander Lukichev <alexander.lukichev@gmail.com>
---
.../990-fix-300-libstdc++-pic.patch | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 package/gcc/4.2.2-avr32-2.1.5/990-fix-300-libstdc++-pic.patch
diff --git a/package/gcc/4.2.2-avr32-2.1.5/990-fix-300-libstdc++-pic.patch b/package/gcc/4.2.2-avr32-2.1.5/990-fix-300-libstdc++-pic.patch
new file mode 100644
index 0000000..a63b3ad
--- /dev/null
+++ b/package/gcc/4.2.2-avr32-2.1.5/990-fix-300-libstdc++-pic.patch
@@ -0,0 +1,20 @@
+libstdc++-v3: fix the effects of pre-applied 300-libstdc++-pic.patch
+
+This version of GCC comes with a number of pre-applied patches, among which is
+300-libstdc++-pic.patch that makes a PIC version of libstdc++. The resulting
+Makefile.in incorrectly refers to object files that should be insde the library.
+
+Signed-off-by: Alexander Lukichev <alexander.lukichev@gmail.com>
+
+diff -uNrp host-gcc-final-4.2.2-avr32-2.1.5.orig/libstdc++-v3/src/Makefile.in host-gcc-final-4.2.2-avr32-2.1.5/libstdc++-v3/src/Makefile.in
+--- host-gcc-final-4.2.2-avr32-2.1.5.orig/libstdc++-v3/src/Makefile.in 2008-07-04 00:18:42.000000000 +0300
++++ host-gcc-final-4.2.2-avr32-2.1.5/libstdc++-v3/src/Makefile.in 2013-08-08 16:15:56.201258882 +0300
+@@ -804,7 +804,7 @@ install_debug:
+
+ install-exec-local:
+ ifeq ($(enable_shared),yes)
+- $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o
++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
+ endif
+
--
1.8.0.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] gcc: fix libstdc++_pic for AVR32
2013-08-09 5:16 [Buildroot] [PATCH 1/1] gcc: fix libstdc++_pic for AVR32 Alexander Lukichev
@ 2013-08-10 19:06 ` Thomas Petazzoni
2013-08-10 19:47 ` Simon Dawson
2013-08-23 4:59 ` Thomas Petazzoni
1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2013-08-10 19:06 UTC (permalink / raw)
To: buildroot
Dear Alexander Lukichev,
On Fri, 9 Aug 2013 08:16:10 +0300, Alexander Lukichev wrote:
> It is not clear why 300-libstdc++-pic.patch pre-applied to
Which 300-libstdc++-pic.patch are you referring to? I don't see anyone
in Buildroot.
Simon, Thiago, as our AVR32 people, why do you think of Alexander's
patch? Can you give it a spin and tell me what you think?
Thanks,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] gcc: fix libstdc++_pic for AVR32
2013-08-10 19:06 ` Thomas Petazzoni
@ 2013-08-10 19:47 ` Simon Dawson
2013-08-12 7:21 ` Alexander Lukichev
0 siblings, 1 reply; 6+ messages in thread
From: Simon Dawson @ 2013-08-10 19:47 UTC (permalink / raw)
To: buildroot
On 10 August 2013 20:06, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Simon, Thiago, as our AVR32 people, why do you think of Alexander's
> patch? Can you give it a spin and tell me what you think?
I'm not sure what specific problem this patch is meant to address.
Alexander: are you trying to solve a build problem here? Or a target
runtime problem? Perhaps the patch description could be expanded a
little...?
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] gcc: fix libstdc++_pic for AVR32
2013-08-10 19:47 ` Simon Dawson
@ 2013-08-12 7:21 ` Alexander Lukichev
2013-08-20 11:02 ` Simon Dawson
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Lukichev @ 2013-08-12 7:21 UTC (permalink / raw)
To: buildroot
Hello,
Sorry for the late reply, was on a trip on weekend.
2013/8/10 Simon Dawson <spdawson@gmail.com>
> I'm not sure what specific problem this patch is meant to address.
> Alexander: are you trying to solve a build problem here? Or a target
> runtime problem? Perhaps the patch description could be expanded a
> little...?
The patch I sent fixes a build problem for me, that arises during the
final stage when libstdc++ is built:
/home/alukiche/Projects/buildroot/buildroot-project/output/host/usr/avr32-buildroot-linux-uclibc/bin/ar
cru libstdc++_pic.a *.o ../libsupc++/*.o
/home/alukiche/Projects/buildroot/buildroot-project/output/host/usr/avr32-buildroot-linux-uclibc/bin/ar:
*.o: No such file or directory
make[5]: *** [install-exec-local] Error 1
make[5]: Leaving directory
`/home/alukiche/Projects/buildroot/buildroot-project/output/build/host-gcc-final-4.2.2-avr32-2.1.5/build/avr32-buildroot-linux-uclibc/libstdc++-v3/src'
make[4]: *** [install-am] Error 2
make[4]: Leaving directory
`/home/alukiche/Projects/buildroot/buildroot-project/output/build/host-gcc-final-4.2.2-avr32-2.1.5/build/avr32-buildroot-linux-uclibc/libstdc++-v3/src'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory
`/home/alukiche/Projects/buildroot/buildroot-project/output/build/host-gcc-final-4.2.2-avr32-2.1.5/build/avr32-buildroot-linux-uclibc/libstdc++-v3'
make[2]: *** [install-target-libstdc++-v3] Error 2
make[2]: Leaving directory
`/home/alukiche/Projects/buildroot/buildroot-project/output/build/host-gcc-final-4.2.2-avr32-2.1.5/build'
make[1]: *** [install] Error 2
make[1]: Leaving directory
`/home/alukiche/Projects/buildroot/buildroot-project/output/build/host-gcc-final-4.2.2-avr32-2.1.5/build'
make: ***
[/home/alukiche/Projects/buildroot/buildroot-project/output/build/host-gcc-final-4.2.2-avr32-2.1.5/.stamp_host_installed]
Error 2
Lines in
host-gcc-final-4.2.2-avr32-2.1.5/build/avr32-buildroot-linux-uclibc/libstdc++-v3/src/Makefile
install-exec-local:
ifeq ($(enable_shared),yes)
$(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o
$(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
endif
are triggered, failing to find object files for the library
libstdc++_pic.a. These files are actually located in .libs/ subdirectory,
not in the current directory (where that Makefile is located). This happens
when I build AVR32 toolchain with C++ support. I have attached a defconfig
that triggers the problem on my host machine.
The triggered lines come from a patch file named 300-libstdc++-pic.patch
that has apparently been applied to GCC 4.2.2 before it was packaged into
an archive file gcc-4.2.2-avr32-2.1.5.tar.bz2 (see .applied_patches_list
inside this archive). Googling for it revealed that this patch has been
used for different versions of the toolchain for AVR32 and MIPS, changing a
little with each version to adapt to it. I have found several versions of
this patch in a repository for Midge (a project for ADM5120 MIPS
microcontroller):
https://github.com/ZigFisher/Midge/tree/master/toolchain/gcc . The patch
appears as early as 3.4.4 and alterates in reference to those object files
between './' (in gcc 4.0.3) and '.libs/' (in gcc 3.4.4, 3.4.5, 3.4.6,
4.1.0). I have not found a version of this patch for 4.2.2 but concluded
that since it fails to find object files for libstdc++_pic.a in current
directory and from version to version of gcc it alterates between './' and
'.libs/', for 4.2.2 they must be in '.libs/'.
I have checked that object files in '.libs/' indeed contain position
independent code (I looked at the build log, where -fPIC has been given to
commands that compile these files; and checked randomly with 'nm <file> |
grep _GLOBAL_OFFSET_TABLE_'). And I have build-tested several C++ packages
with the built toolchain. I did not go as far as trying to run them: no
AVR32 hardware at hand and I am not skilled enough to set up an AVR32
virtual environment quickly.
Without this fix the GCC fails to build with C++ support always, at least
on my host machine ('gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)', binutils
2.20.51.0.7-8.fc14). The fix solves the problem.
It seems strange to me that GCC 4.2.2 for AVR32 is so dependent on which
machine it is built on: apparently not many people on this list have
encountered the problem that I have experienced.
Thomas Petazzoni, should I send an updated version of my patch with a
concise version of the explanation above or is it not worth it? Thanks.
--
Best regards,
Alexander Lukichev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130812/3ec1dd0d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: defconfig
Type: application/octet-stream
Size: 260 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130812/3ec1dd0d/attachment-0001.obj>
^ permalink raw reply [flat|nested] 6+ messages in thread* [Buildroot] [PATCH 1/1] gcc: fix libstdc++_pic for AVR32
2013-08-12 7:21 ` Alexander Lukichev
@ 2013-08-20 11:02 ` Simon Dawson
0 siblings, 0 replies; 6+ messages in thread
From: Simon Dawson @ 2013-08-20 11:02 UTC (permalink / raw)
To: buildroot
On 12 August 2013 08:21, Alexander Lukichev
<alexander.lukichev@gmail.com> wrote:
> Without this fix the GCC fails to build with C++ support always, at least
> on my host machine ('gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)', binutils
> 2.20.51.0.7-8.fc14). The fix solves the problem.
This works for me too, hence:
Acked-by: Simon Dawson <spdawson@gmail.com>
Tested-by: Simon Dawson <spdawson@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] gcc: fix libstdc++_pic for AVR32
2013-08-09 5:16 [Buildroot] [PATCH 1/1] gcc: fix libstdc++_pic for AVR32 Alexander Lukichev
2013-08-10 19:06 ` Thomas Petazzoni
@ 2013-08-23 4:59 ` Thomas Petazzoni
1 sibling, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2013-08-23 4:59 UTC (permalink / raw)
To: buildroot
Dear Alexander Lukichev,
On Fri, 9 Aug 2013 08:16:10 +0300, Alexander Lukichev wrote:
> It is not clear why 300-libstdc++-pic.patch pre-applied to
> gcc-4.2.2-avr32-2.1.5 seems to have come from some older version
> of gcc (as early as 4.0.3). This older patch incorrectly refers to
> object files to be included in the library libstdc++_pic.a as *.o,
> while their location seems to be in .libs/*.o (see the contents at
> e.g. https://github.com/ZigFisher/Midge/blob/master/toolchain/gcc/4.0.3/300-libstdc%2B%2B-pic.patch ).
> The same patch for gcc 4.1.0 refers to the files as .libs/*.o (see
> https://github.com/ZigFisher/Midge/blob/master/toolchain/gcc/4.1.0/300-libstdc%2B%2B-pic.patch ).
> This patch corrects rules in Makefile.in.
>
> Signed-off-by: Alexander Lukichev <alexander.lukichev@gmail.com>
Applied, thanks.
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-08-23 4:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-09 5:16 [Buildroot] [PATCH 1/1] gcc: fix libstdc++_pic for AVR32 Alexander Lukichev
2013-08-10 19:06 ` Thomas Petazzoni
2013-08-10 19:47 ` Simon Dawson
2013-08-12 7:21 ` Alexander Lukichev
2013-08-20 11:02 ` Simon Dawson
2013-08-23 4:59 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox