linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: weigelt@metux.de
Cc: linux-embedded <linux-embedded@vger.kernel.org>
Subject: Re: Firmware Linux (was Re: Cross Compiler and loads of issues)
Date: Tue, 24 Jun 2008 20:49:26 -0500	[thread overview]
Message-ID: <200806242049.27143.rob@landley.net> (raw)
In-Reply-To: <20080616043812.GB32139@nibiru.local>

On Sunday 15 June 2008 23:38:12 Enrico Weigelt wrote:
> * Rob Landley <rob@landley.net> schrieb:
> > Did you try my FWL project? :)
> >
> > http://landley.net/code/firmware
>
> hmm, doesnt look like supporting sysroot ...

It doesn't use sysroot.  It makes the compiler relocatable using an updated 
version of the old uClibc wrapper script, which rewrites each glibc command 
line to start with --nostinc --nostdlib and then adds the correct paths back 
in from the ground up.

Have you ever run gcc under strace?  Or worse, looked at the gcc path logic 
source code?  It's a mess.  It gets paths from ./configure options, it gets 
paths from spec files, it adds hardwired paths in the C source code, it 
checks enviroment variables to get more paths, and this isn't counting the 
paths you tell it on the command line.  Every time they gave up on the 
previous approach because it was obviously unworkable, they NEVER REMOVED 
ANYTHING.  They just added yet another layer on top of it, falling back to 
the previous one each time.  It never occurred to them that people would want 
to make it NOT check paths like /usr/include.  They just keep piling on more 
and more, appending to a big vararray and never removing anything.

Do you know how sysroot is implemented?  It still hardwires absolute paths 
into the binary, but then it does a string compare with the start of the 
hardwired path so it knows how much to trim off when substituting another 
path instead.

I once tried to work up a patch to remove the obsolete or clearly defective 
parts of the gcc path logic, but when my patch got large than 10,000 lines I 
gave up and went to a wrapper script.  The only way to make the gcc path 
logic reliable is to NOT USE IT.  Hence the wrapper script to tell it to 
ignore all the paths it _thinks_ it knows, and check in exactly these places 
(and only those places) instead.  Then you can run the result under strace 
without wanting to throw up quite so much.

> cu

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.

      reply	other threads:[~2008-06-25  1:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-12 17:52 Cross Compiler and loads of issues Shaz
2008-06-12 18:19 ` Wolfgang Denk
2008-06-14  9:44   ` Shaz
2008-06-12 18:26 ` Matthias Kaehlcke
2008-06-12 18:39 ` Bill Traynor
2008-06-12 18:49   ` Enrico Weigelt
2008-06-12 19:02     ` Shaz
2008-06-12 19:54       ` George G. Davis
2008-06-13 13:52   ` Bill Traynor
2008-06-12 18:56 ` Bill Gatliff
2008-06-12 19:30 ` Glenn Henshaw
2008-06-13  4:34 ` Robert Schwebel
2008-06-13  5:14   ` Wang, Baojun
2008-06-13  9:24 ` Wookey
2008-06-13 12:00   ` Shaz
2008-06-13 14:13     ` Bill Traynor
2008-06-13 14:46       ` Jamie Lokier
2008-06-13 15:19         ` Enrico Weigelt
2008-06-14  1:46           ` Jamie Lokier
2008-06-13 15:28         ` Bill Traynor
2008-06-13 17:12           ` Enrico Weigelt
2008-06-14  1:57           ` Jamie Lokier
2008-06-14  6:57             ` Greg Ungerer
2008-06-14  6:43         ` Greg Ungerer
2008-06-13 15:11       ` Shaz
2008-06-13 17:24 ` Firmware Linux (was Re: Cross Compiler and loads of issues) Rob Landley
2008-06-16  4:38   ` Enrico Weigelt
2008-06-25  1:49     ` Rob Landley [this message]

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=200806242049.27143.rob@landley.net \
    --to=rob@landley.net \
    --cc=linux-embedded@vger.kernel.org \
    --cc=weigelt@metux.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;
as well as URLs for NNTP newsgroup(s).