mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Franck JULLIEN <franck.jullien@gmail.com>
To: barebox <barebox@lists.infradead.org>
Subject: Linker question
Date: Wed, 14 Dec 2011 00:14:08 +0100	[thread overview]
Message-ID: <CAJfOKBws5V3VmfnW0eXZkgR+TgAo4_ZpSviy6pLF61fevpG7DQ@mail.gmail.com> (raw)

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

             reply	other threads:[~2011-12-13 23:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-13 23:14 Franck JULLIEN [this message]
2011-12-14 10:17 ` Sascha Hauer
2011-12-14 10:43   ` Franck JULLIEN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJfOKBws5V3VmfnW0eXZkgR+TgAo4_ZpSviy6pLF61fevpG7DQ@mail.gmail.com \
    --to=franck.jullien@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox