All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] sawman: Link using gcc instead of ld
@ 2013-12-06 16:30 Vicente Olivert Riera
  2013-12-06 18:08 ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Vicente Olivert Riera @ 2013-12-06 16:30 UTC (permalink / raw)
  To: buildroot

Using ld may cause a link failure due to using the default emulation
linker which is configured when building the linker in binutils.  Using
gcc instead will pass the appropriate -m value because the compiler
knows the ABI you are using.

Here is an example of the failure:

ld: .libs/libdirectfbwm_sawman.a.tmp/sawman_wm.o: ABI is incompatible
with that of the selected emulation
ld: failed to merge target specific data of file
.libs/libdirectfbwm_sawman.a.tmp/sawman_wm.o
ld: Attempt to do relocatable link with elf64-tradbigmips input and
elf32-tradbigmips output
ld: .libs/libdirectfbwm_sawman.a.tmp/sawman_wm.o: file class ELFCLASS64
incompatible with ELFCLASS32
ld: final link failed: File in wrong format

Fixes:

   http://autobuild.buildroot.net/results/e4b/e4b77681a44626efa2a44627604630697e785086/

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 .../sawman-001-link-using-gcc-instead-of-ld.patch  |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
 create mode 100644 package/sawman/sawman-001-link-using-gcc-instead-of-ld.patch

diff --git a/package/sawman/sawman-001-link-using-gcc-instead-of-ld.patch b/package/sawman/sawman-001-link-using-gcc-instead-of-ld.patch
new file mode 100644
index 0000000..5472651
--- /dev/null
+++ b/package/sawman/sawman-001-link-using-gcc-instead-of-ld.patch
@@ -0,0 +1,20 @@
+sawman: Link using gcc instead of ld
+
+Using ld may cause a link failure due to using the default emulation
+linker which is configured when building the linker in binutils.  Using
+gcc instead will pass the appropriate -m value because the compiler 
+knows the ABI you are using.
+
+Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
+
+--- SaWMan-1.6.3/wm/sawman/Makefile.in.orig	2013-12-06 14:22:22.675409826 +0000
++++ SaWMan-1.6.3/wm/sawman/Makefile.in	2013-12-06 16:04:03.383752843 +0000
+@@ -622,7 +622,7 @@ uninstall-am: uninstall-wmDATA uninstall
+ 	if test -d $<.tmp; then rmdir $<.tmp; fi
+ 	mkdir $<.tmp
+ 	(cd $<.tmp && $(AR) x ../../$<)
+-	$(LD) -o $@ -r $<.tmp/*.o
++	$(CC) $(LDFLAGS) -nostdlib -o $@ -r $<.tmp/*.o
+ 	rm -f $<.tmp/*.o && rmdir $<.tmp
+ 
+ .PHONY: $(LTLIBRARIES:%.la=.libs/%.a)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] sawman: Link using gcc instead of ld
  2013-12-06 16:30 [Buildroot] [PATCH] sawman: Link using gcc instead of ld Vicente Olivert Riera
@ 2013-12-06 18:08 ` Thomas Petazzoni
  2013-12-09 11:47   ` Vicente Olivert Riera
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2013-12-06 18:08 UTC (permalink / raw)
  To: buildroot

Dear Vicente Olivert Riera,

On Fri, 6 Dec 2013 16:30:28 +0000, Vicente Olivert Riera wrote:

> +--- SaWMan-1.6.3/wm/sawman/Makefile.in.orig	2013-12-06 14:22:22.675409826 +0000
> ++++ SaWMan-1.6.3/wm/sawman/Makefile.in	2013-12-06 16:04:03.383752843 +0000

Makefile.in is generated from Makefile.am. So we shouldn't be fixing
Makefile.in, but instead Makefile.am or the process that generates
Makefile.in from Makefile.am.

What happens if you simply add:

SAWMAN_AUTORECONF = YES

 ?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] sawman: Link using gcc instead of ld
  2013-12-06 18:08 ` Thomas Petazzoni
@ 2013-12-09 11:47   ` Vicente Olivert Riera
  2013-12-09 11:58     ` Vicente Olivert Riera
  0 siblings, 1 reply; 7+ messages in thread
From: Vicente Olivert Riera @ 2013-12-09 11:47 UTC (permalink / raw)
  To: buildroot

On 12/06/2013 06:08 PM, Thomas Petazzoni wrote:
> Dear Vicente Olivert Riera,
>
> On Fri, 6 Dec 2013 16:30:28 +0000, Vicente Olivert Riera wrote:
>
>> +--- SaWMan-1.6.3/wm/sawman/Makefile.in.orig	2013-12-06 14:22:22.675409826 +0000
>> ++++ SaWMan-1.6.3/wm/sawman/Makefile.in	2013-12-06 16:04:03.383752843 +0000
>
> Makefile.in is generated from Makefile.am. So we shouldn't be fixing
> Makefile.in, but instead Makefile.am or the process that generates
> Makefile.in from Makefile.am.
>
> What happens if you simply add:
>
> SAWMAN_AUTORECONF = YES
>
>   ?

You still have the same problem.

> Best regards,
>
> Thomas
>


-- 
Vincent

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] sawman: Link using gcc instead of ld
  2013-12-09 11:47   ` Vicente Olivert Riera
@ 2013-12-09 11:58     ` Vicente Olivert Riera
  2013-12-09 16:48       ` Markos Chandras
  0 siblings, 1 reply; 7+ messages in thread
From: Vicente Olivert Riera @ 2013-12-09 11:58 UTC (permalink / raw)
  To: buildroot

On 12/09/2013 11:47 AM, Vicente Olivert Riera wrote:
> On 12/06/2013 06:08 PM, Thomas Petazzoni wrote:
>> Dear Vicente Olivert Riera,
>>
>> On Fri, 6 Dec 2013 16:30:28 +0000, Vicente Olivert Riera wrote:
>>
>>> +--- SaWMan-1.6.3/wm/sawman/Makefile.in.orig    2013-12-06
>>> 14:22:22.675409826 +0000
>>> ++++ SaWMan-1.6.3/wm/sawman/Makefile.in    2013-12-06
>>> 16:04:03.383752843 +0000
>>
>> Makefile.in is generated from Makefile.am. So we shouldn't be fixing
>> Makefile.in, but instead Makefile.am or the process that generates
>> Makefile.in from Makefile.am.
>>
>> What happens if you simply add:
>>
>> SAWMAN_AUTORECONF = YES
>>
>>   ?
>
> You still have the same problem.
>
>> Best regards,
>>
>> Thomas
>>
>
>

Adding:

LD = $(CC) -nostdlib

to Makefile.am and also:

SAWMAN_AUTORECONF = YES

to sawman.mk fixes the problem.

What do you think about this solution?

-- 
Vincent

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] sawman: Link using gcc instead of ld
  2013-12-09 11:58     ` Vicente Olivert Riera
@ 2013-12-09 16:48       ` Markos Chandras
  2013-12-09 17:57         ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Markos Chandras @ 2013-12-09 16:48 UTC (permalink / raw)
  To: buildroot

On 12/09/2013 11:58 AM, Vicente Olivert Riera wrote:
> On 12/09/2013 11:47 AM, Vicente Olivert Riera wrote:
>> On 12/06/2013 06:08 PM, Thomas Petazzoni wrote:
>>> Dear Vicente Olivert Riera,
>>>
>>> On Fri, 6 Dec 2013 16:30:28 +0000, Vicente Olivert Riera wrote:
>>>
>>>> +--- SaWMan-1.6.3/wm/sawman/Makefile.in.orig    2013-12-06
>>>> 14:22:22.675409826 +0000
>>>> ++++ SaWMan-1.6.3/wm/sawman/Makefile.in    2013-12-06
>>>> 16:04:03.383752843 +0000
>>>
>>> Makefile.in is generated from Makefile.am. So we shouldn't be fixing
>>> Makefile.in, but instead Makefile.am or the process that generates
>>> Makefile.in from Makefile.am.
>>>
>>> What happens if you simply add:
>>>
>>> SAWMAN_AUTORECONF = YES
>>>
>>>   ?
>>
>> You still have the same problem.
>>
>>> Best regards,
>>>
>>> Thomas
>>>
>>
>>
>
> Adding:
>
> LD = $(CC) -nostdlib
>
> to Makefile.am and also:
>
> SAWMAN_AUTORECONF = YES
>
> to sawman.mk fixes the problem.
>
> What do you think about this solution?
>

Yes this is preferred. You should patch configure.ac or Makefile.am (if 
they are available) and run autoreconf as suggested.

-- 
markos

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] sawman: Link using gcc instead of ld
  2013-12-09 16:48       ` Markos Chandras
@ 2013-12-09 17:57         ` Thomas Petazzoni
  2013-12-10  9:36           ` Markos Chandras
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2013-12-09 17:57 UTC (permalink / raw)
  To: buildroot

Dear Markos Chandras,

On Mon, 9 Dec 2013 16:48:53 +0000, Markos Chandras wrote:

> > Adding:
> >
> > LD = $(CC) -nostdlib
> >
> > to Makefile.am and also:
> >
> > SAWMAN_AUTORECONF = YES
> >
> > to sawman.mk fixes the problem.
> >
> > What do you think about this solution?
> 
> Yes this is preferred. You should patch configure.ac or Makefile.am (if 
> they are available) and run autoreconf as suggested.

I definitely agree that patching the Makefile.am and using
<pkg>_AUTORECONF is the preferred way.

However, I find it weird that we need to add LD = $(CC) -nostdlib in
the Makefile.am. There are plenty of other autotools-based packages
that generate libraries, including private libraries, and they work
just fine. Isn't there a better fix that can hopefully be upstreamed?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] sawman: Link using gcc instead of ld
  2013-12-09 17:57         ` Thomas Petazzoni
@ 2013-12-10  9:36           ` Markos Chandras
  0 siblings, 0 replies; 7+ messages in thread
From: Markos Chandras @ 2013-12-10  9:36 UTC (permalink / raw)
  To: buildroot

On 12/09/2013 05:57 PM, Thomas Petazzoni wrote:
> Dear Markos Chandras,
>
> On Mon, 9 Dec 2013 16:48:53 +0000, Markos Chandras wrote:
>
>>> Adding:
>>>
>>> LD = $(CC) -nostdlib
>>>
>>> to Makefile.am and also:
>>>
>>> SAWMAN_AUTORECONF = YES
>>>
>>> to sawman.mk fixes the problem.
>>>
>>> What do you think about this solution?
>>
>> Yes this is preferred. You should patch configure.ac or Makefile.am (if
>> they are available) and run autoreconf as suggested.
>
> I definitely agree that patching the Makefile.am and using
> <pkg>_AUTORECONF is the preferred way.
>
> However, I find it weird that we need to add LD = $(CC) -nostdlib in
> the Makefile.am. There are plenty of other autotools-based packages
> that generate libraries, including private libraries, and they work
> just fine. Isn't there a better fix that can hopefully be upstreamed?
>
> Best regards,
>
> Thomas
>
Hi Thomas,

I am not familiar with the code. I haven't examined the Makefiles to be 
honest. A better fix would be to identify the direct use of $(LD) in the 
Makefile for linking and replace it with $(CC). I did something similar 
for directfb

http://git.buildroot.net/buildroot/tree/package/directfb/directfb-use-gcc-link.patch

-- 
markos

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-12-10  9:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-06 16:30 [Buildroot] [PATCH] sawman: Link using gcc instead of ld Vicente Olivert Riera
2013-12-06 18:08 ` Thomas Petazzoni
2013-12-09 11:47   ` Vicente Olivert Riera
2013-12-09 11:58     ` Vicente Olivert Riera
2013-12-09 16:48       ` Markos Chandras
2013-12-09 17:57         ` Thomas Petazzoni
2013-12-10  9:36           ` Markos Chandras

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.