mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Linker question
@ 2011-12-13 23:14 Franck JULLIEN
  2011-12-14 10:17 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Franck JULLIEN @ 2011-12-13 23:14 UTC (permalink / raw)
  To: barebox

Hi,

I'm doing some tests with the openrisc processor. As I'm building
barebox I have a question
related to the linking of barebox.

In order to get uint64 arithmetic functions, I need to add "-L $(shell
dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc"
to the final link (only way ? found this in uboot).

However, if I do this using LDFLAGS_barebox I get :

/opt/crosstool/or32/or32-elf/bin/or32-elf-ld  -Map barebox.map -L
/opt/crosstool/or32/or32-elf-1.0rc1/bin/../lib/gcc/or32-elf/4.5.1-or32-1.0rc4
-lgcc -o barebox -T arch/openrisc/cpu/barebox.lds  --start-group
common/built-in.o  drivers/built-in.o  commands/built-in.o
lib/built-in.o  crypto/built-in.o  net/built-in.o  fs/built-in.o
arch/openrisc/boards/generic/built-in.o  arch/openrisc/lib/built-in.o
arch/openrisc/cpu/built-in.o --end-group

And it doesn't work. It works if "-L
/opt/crosstool/or32/or32-elf-1.0rc1/bin/../lib/gcc/or32-elf/4.5.1-or32-1.0rc4
-lgcc" is at the end of the command line:

/opt/crosstool/or32/or32-elf/bin/or32-elf-ld -Map barebox.map -o
barebox -T arch/openrisc/cpu/barebox.lds --start-group
common/built-in.o  drivers/built-in.o  commands/built-in.o
lib/built-in.o  crypto/built-in.o  net/built-in.o  fs/built-in.o
arch/openrisc/boards/generic/built-in.o  arch/openrisc/lib/built-in.o
arch/openrisc/cpu/built-in.o --end-group -L
/opt/crosstool/or32/or32-elf-1.0rc1/bin/../lib/gcc/or32-elf/4.5.1-or32-1.0rc4
-lgcc

Any idea on why this is happening ?

The only way I found to fix this is to move LDFLAGS_barebox in the
main Makefile:

-      cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
+      cmd_barebox__ ?= $(LD) $(LDFLAGS)  -o $@ \
       -T $(barebox-lds) $(barebox-head)                         \
-      --start-group $(barebox-common) --end-group                  \
+      --start-group $(barebox-common) --end-group $(LDFLAGS_barebox)
               \
       $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^)

What do you think about this problem ?

Thanks,
Franck.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: Linker question
  2011-12-13 23:14 Linker question Franck JULLIEN
@ 2011-12-14 10:17 ` Sascha Hauer
  2011-12-14 10:43   ` Franck JULLIEN
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2011-12-14 10:17 UTC (permalink / raw)
  To: Franck JULLIEN; +Cc: barebox

Hi Franck,

On Wed, Dec 14, 2011 at 12:14:08AM +0100, Franck JULLIEN wrote:
> Hi,
> 
> I'm doing some tests with the openrisc processor. As I'm building
> barebox I have a question
> related to the linking of barebox.
> 
> In order to get uint64 arithmetic functions, I need to add "-L $(shell
> dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc"
> to the final link (only way ? found this in uboot).
> 
> However, if I do this using LDFLAGS_barebox I get :
> 
> /opt/crosstool/or32/or32-elf/bin/or32-elf-ld  -Map barebox.map -L
> /opt/crosstool/or32/or32-elf-1.0rc1/bin/../lib/gcc/or32-elf/4.5.1-or32-1.0rc4
> -lgcc -o barebox -T arch/openrisc/cpu/barebox.lds  --start-group
> common/built-in.o  drivers/built-in.o  commands/built-in.o
> lib/built-in.o  crypto/built-in.o  net/built-in.o  fs/built-in.o
> arch/openrisc/boards/generic/built-in.o  arch/openrisc/lib/built-in.o
> arch/openrisc/cpu/built-in.o --end-group
> 
> And it doesn't work. It works if "-L
> /opt/crosstool/or32/or32-elf-1.0rc1/bin/../lib/gcc/or32-elf/4.5.1-or32-1.0rc4
> -lgcc" is at the end of the command line:
> 
> /opt/crosstool/or32/or32-elf/bin/or32-elf-ld -Map barebox.map -o
> barebox -T arch/openrisc/cpu/barebox.lds --start-group
> common/built-in.o  drivers/built-in.o  commands/built-in.o
> lib/built-in.o  crypto/built-in.o  net/built-in.o  fs/built-in.o
> arch/openrisc/boards/generic/built-in.o  arch/openrisc/lib/built-in.o
> arch/openrisc/cpu/built-in.o --end-group -L
> /opt/crosstool/or32/or32-elf-1.0rc1/bin/../lib/gcc/or32-elf/4.5.1-or32-1.0rc4
> -lgcc
> 
> Any idea on why this is happening ?
> 
> The only way I found to fix this is to move LDFLAGS_barebox in the
> main Makefile:
> 
> -      cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
> +      cmd_barebox__ ?= $(LD) $(LDFLAGS)  -o $@ \
>        -T $(barebox-lds) $(barebox-head)                         \
> -      --start-group $(barebox-common) --end-group                  \
> +      --start-group $(barebox-common) --end-group $(LDFLAGS_barebox)
>                \
>        $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^)
> 
> What do you think about this problem ?

The kernel currently does it the same way for openrisc. The other
architectures have there own implementation of the 64bit arithmetix
functions inside the kernel (and barebox) which is IMO cleaner. Maybe
you can grab them from the gcc source code and use them in barebox
instead.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: Linker question
  2011-12-14 10:17 ` Sascha Hauer
@ 2011-12-14 10:43   ` Franck JULLIEN
  0 siblings, 0 replies; 3+ messages in thread
From: Franck JULLIEN @ 2011-12-14 10:43 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

2011/12/14 Sascha Hauer <s.hauer@pengutronix.de>:
> Hi Franck,
>
> On Wed, Dec 14, 2011 at 12:14:08AM +0100, Franck JULLIEN wrote:
>> Hi,
>>
>> I'm doing some tests with the openrisc processor. As I'm building
>> barebox I have a question
>> related to the linking of barebox.
>>
>> In order to get uint64 arithmetic functions, I need to add "-L $(shell
>> dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc"
>> to the final link (only way ? found this in uboot).
>>
>> However, if I do this using LDFLAGS_barebox I get :
>>
>> /opt/crosstool/or32/or32-elf/bin/or32-elf-ld  -Map barebox.map -L
>> /opt/crosstool/or32/or32-elf-1.0rc1/bin/../lib/gcc/or32-elf/4.5.1-or32-1.0rc4
>> -lgcc -o barebox -T arch/openrisc/cpu/barebox.lds  --start-group
>> common/built-in.o  drivers/built-in.o  commands/built-in.o
>> lib/built-in.o  crypto/built-in.o  net/built-in.o  fs/built-in.o
>> arch/openrisc/boards/generic/built-in.o  arch/openrisc/lib/built-in.o
>> arch/openrisc/cpu/built-in.o --end-group
>>
>> And it doesn't work. It works if "-L
>> /opt/crosstool/or32/or32-elf-1.0rc1/bin/../lib/gcc/or32-elf/4.5.1-or32-1.0rc4
>> -lgcc" is at the end of the command line:
>>
>> /opt/crosstool/or32/or32-elf/bin/or32-elf-ld -Map barebox.map -o
>> barebox -T arch/openrisc/cpu/barebox.lds --start-group
>> common/built-in.o  drivers/built-in.o  commands/built-in.o
>> lib/built-in.o  crypto/built-in.o  net/built-in.o  fs/built-in.o
>> arch/openrisc/boards/generic/built-in.o  arch/openrisc/lib/built-in.o
>> arch/openrisc/cpu/built-in.o --end-group -L
>> /opt/crosstool/or32/or32-elf-1.0rc1/bin/../lib/gcc/or32-elf/4.5.1-or32-1.0rc4
>> -lgcc
>>
>> Any idea on why this is happening ?
>>
>> The only way I found to fix this is to move LDFLAGS_barebox in the
>> main Makefile:
>>
>> -      cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
>> +      cmd_barebox__ ?= $(LD) $(LDFLAGS)  -o $@ \
>>        -T $(barebox-lds) $(barebox-head)                         \
>> -      --start-group $(barebox-common) --end-group                  \
>> +      --start-group $(barebox-common) --end-group $(LDFLAGS_barebox)
>>                \
>>        $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^)
>>
>> What do you think about this problem ?
>
> The kernel currently does it the same way for openrisc. The other
> architectures have there own implementation of the 64bit arithmetix
> functions inside the kernel (and barebox) which is IMO cleaner. Maybe
> you can grab them from the gcc source code and use them in barebox
> instead.
>
> Sascha
>
> --
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Ok thanks,

I'll see what I can do.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2011-12-14 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-13 23:14 Linker question Franck JULLIEN
2011-12-14 10:17 ` Sascha Hauer
2011-12-14 10:43   ` Franck JULLIEN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox