public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Introduce a new linker flag LDFLAGS_FINAL
Date: Tue, 15 Feb 2011 04:02:44 -0500	[thread overview]
Message-ID: <201102150402.45553.vapier@gentoo.org> (raw)
In-Reply-To: <20110201144013.5924e63f@udp111988uds.am.freescale.net>

On Tuesday, February 01, 2011 15:40:13 Scott Wood wrote:
> Before 8aba9dc, the flags for the final link were produced by taking
> the existing LDFLAGS, and adding:
> -Bstatic -T <linkerscript> $(PLATFORM_LDFLAGS) -Ttext <addr>.

i think you're skipping a fairly large piece of the picture -- the whole 
reason for 8aba9dc commit in the first place: commit 6d8962e814 (introduction 
of partial linking).  before that commit, the linker was only used in one 
place: the final u-boot link.  because of that, LDFLAGS was only used in one 
place.  so people put both target-specific (u-boot) and linker-specific (ld) 
flags into the same place (LDFLAGS).  but with partial linking, that was no 
longer possible.  we needed a way to differentiate between the two and thus 
LDFLAGS_$@ was born.

so commit 8aba9dc is not something made for fun, but to fix real bugs people 
were seeing while building with bi-endian toolchains (arm/superh/mips/probably 
others), or bi-abi toolchains (blackfin/arm/probably others).

> This included anything that cpu/board code added to LDFLAGS -- some
> architectures added --gc-sections, x86 added --cref, etc.  Since the above
> flags are added to LDFLAGS, rather than replacing them, these flags got
> used in the final link.
> 
> Commit 8aba9dc introduces LDFLAGS_u-boot, so that LDFLAGS is no longer the
> source for the flags for the final link.  It generates LDFLAGS_u-boot using
> PLATFORM_LDFLAGS, not LDFLAGS.  It converts most of the board/cpu updates
> to LDFLAGS into LDFLAGS_u-boot, but it missed --cref.

err, i dont think this is correct.  LDFLAGS is no longer the *only* source for 
the final link.  if you look at the actual target, you'll see it using 
$(LDFLAGS) $(LDFLAGS_$(@F)).

> I don't see any other LDFLAGS changes in board/cpu code, so the distinction
> between using LDFLAGS and PLATFORM_LDFLAGS should have no other impact on
> current boards.  However, the patch appears to be intended to support
> platform linker flags that need to be used during partial link, which
> would involve board/cpu additions to LDFLAGS.  This change would break that
> only if those options need to be used for partial link *only*, and cannot
> be used in the final link.  In such a case I'd suggest using something
> like LDFLAGS_PARTIAL to make this explicit.  But I'd be surprised if that
> were actually the case.

if Linux hasnt had an issue with flags that are valid only during partial 
linking, then i dont think u-boot will either.

> If you're looking to cut down on the number of variables, it's not clear to
> me what PLATFORM_LDFLAGS is supposed to mean distinct from adding to
> LDFLAGS.

historically, ive never really seen much (any?) value in the split between 
PLATFORM_XXX and XXX.  i say we kill all the PLATFORM_XXX cruft.

ultimately, LDFLAGS_FINAL makes sense to me.  we cant override LD, nor can we 
override LDFLAGS, and it sucks if people have to duplicate flags in multiple 
variables when all they care about is the final link.  it's unavoidable pain 
imo born of attempting to build & finally link multiple applications in a 
single tree.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110215/67685ccc/attachment.pgp 

  parent reply	other threads:[~2011-02-15  9:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-31 18:32 [U-Boot] [PATCH] Introduce a new linker flag LDFLAGS_FINAL Haiying.Wang at freescale.com
2011-01-31 19:33 ` Wolfgang Denk
2011-01-31 19:55   ` Scott Wood
2011-02-01  7:34     ` Wolfgang Denk
2011-02-01 14:59       ` Haiying Wang
2011-02-01 16:24       ` Scott Wood
2011-02-01 19:32         ` Wolfgang Denk
2011-02-01 19:51           ` Scott Wood
2011-02-01 20:20             ` Wolfgang Denk
2011-02-01 20:40               ` Scott Wood
2011-02-04 15:52                 ` Haiying Wang
2011-02-15  9:02                 ` Mike Frysinger [this message]
2011-02-16  0:51                   ` Scott Wood
2011-02-17  5:01                     ` Mike Frysinger
2011-02-04 22:56             ` Graeme Russ
2011-01-31 20:14   ` Haiying Wang
2011-01-31 20:30     ` Wolfgang Denk
     [not found]       ` <1297878184.1977.18.camel@haiying-laptop>
2011-02-16 18:29         ` Wolfgang Denk
2011-02-16 18:40           ` Haiying Wang
2011-02-16 18:58             ` Wolfgang Denk
2011-02-17  5:37               ` Mike Frysinger
2011-02-17  8:33                 ` Wolfgang Denk
2011-02-17 19:28               ` Haiying Wang
2011-02-17 20:38                 ` Haiying Wang
2011-02-22 19:39                   ` Wolfgang Denk

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=201102150402.45553.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox