All of lore.kernel.org
 help / color / mirror / Atom feed
From: Remy Bohmer <linux@bohmer.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS
Date: Thu, 27 Jan 2011 18:53:37 +0100	[thread overview]
Message-ID: <AANLkTinwT+pVLdCZurT_+kt5nyNeRy6K8i66DhSRKS8T@mail.gmail.com> (raw)
In-Reply-To: <1294277034-6509-1-git-send-email-iwamatsu@nigauri.org>

Hi,

2011/1/6 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>:
> Linker needs to use the proper endian/bfd flags even when doing partial linking.
> LDFLAGS_u-boot sets linker option which is called it when U-boot is built
> (u-boot final).
> LDFLAGS sets necessary option by partial linking (use in cmd_link_o_target).
>
> CC: Mike Frysinger <vapier@gentoo.org>
> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> ---

This patch breaks compilation for some ARM based boards, I get for
example this error:
===============================================================
make -C examples/standalone all
make[1]: Entering directory `/home/bohm/Workarea/u-boot/examples/standalone'
arm-none-eabi-gcc  -g  -Os   -fno-common -ffixed-r8 -msoft-float
-D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0x23f00000
-I/home/bohm/Workarea/u-boot/include -fno-builtin -ffreestanding
-nostdinc -isystem
/home/bohm/x-tools/CodeSourcery/arm-2009q1/bin/../lib/gcc/arm-none-eabi/4.3.3/include
-pipe  -DCONFIG_ARM -D__ARM__ -marm  -mabi=aapcs-linux
-mno-thumb-interwork -march=armv5te  -Wall -Wstrict-prototypes
-fno-stack-protector -fno-toplevel-reorder   -o hello_world.o
hello_world.c -c
arm-none-eabi-gcc  -g  -Os   -fno-common -ffixed-r8 -msoft-float
-D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0x23f00000
-I/home/bohm/Workarea/u-boot/include -fno-builtin -ffreestanding
-nostdinc -isystem
/home/bohm/x-tools/CodeSourcery/arm-2009q1/bin/../lib/gcc/arm-none-eabi/4.3.3/include
-pipe  -DCONFIG_ARM -D__ARM__ -marm  -mabi=aapcs-linux
-mno-thumb-interwork -march=armv5te  -Wall -Wstrict-prototypes
-fno-stack-protector -fno-toplevel-reorder   -o stubs.o stubs.c -c
arm-none-eabi-ld  -pie -r -o libstubs.o  stubs.o

----> arm-none-eabi-ld: -r and -shared may not be used together

make[1]: *** [libstubs.o] Error 1
make[1]: Leaving directory `/home/bohm/Workarea/u-boot/examples/standalone'
make: *** [examples/standalone] Error 2
===============================================================

It seems that the ' -pie' and '-r' flags may not be used together.

The ' -r' flag is defined at line 263 in config.mk:
cmd_link_o_target = $(if $(strip $1),\
                      $(LD) $(LDFLAGS) -r -o $@ $1,\
                      rm -f $@; $(AR) rcs $@ )

This patch now includes $(LDFLAGS) which was previously not included:
>  # Location of a usable BFD library, where we define "usable" as
> @@ -259,7 +261,7 @@ $(obj)%.s:  %.c
>
>  # If the list of objects to link is empty, just create an empty built-in.o
>  cmd_link_o_target = $(if $(strip $1),\
> -                     $(LD) -r -o $@ $1 ,\
> +                     $(LD) $(LDFLAGS) -r -o $@ $1,\
>                      rm -f $@; $(AR) rcs $@ )
>

Since it is included the following flag is added from arch/arm/config.mk:
PLATFORM_LDFLAGS += -pie

This results in the error as listed above.

Any suggestions how to fix it?

Kind regards,

Remy

  parent reply	other threads:[~2011-01-27 17:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-06  1:23 [U-Boot] [PATCH v2] Divides variable of linker flags to LDFLAGS-u-boot and LDFLAGS Nobuhiro Iwamatsu
2011-01-07  3:40 ` Mike Frysinger
2011-01-25 21:22 ` Wolfgang Denk
2011-01-27 17:53 ` Remy Bohmer [this message]
2011-01-27 18:07   ` Remy Bohmer
2011-01-27 23:32     ` Nobuhiro Iwamatsu

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=AANLkTinwT+pVLdCZurT_+kt5nyNeRy6K8i66DhSRKS8T@mail.gmail.com \
    --to=linux@bohmer.net \
    --cc=u-boot@lists.denx.de \
    /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 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.