delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2008/07/07/21:28:59

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: dj AT delorie DOT com
X-Recipient: djgpp AT delorie DOT com
Message-ID: <BAY139-W49232EA2418730F53832F0E6970@phx.gbl>
X-Originating-IP: [131.107.0.103]
From: Jay <jayk123 AT hotmail DOT com>
To: DJ Delorie <dj AT delorie DOT com>
CC: <djgpp AT delorie DOT com>
Subject: RE: libstdc++ writev/2.04/patches upstream?
Date: Tue, 8 Jul 2008 01:28:18 +0000
Importance: Low
In-Reply-To: <200807072346.m67NklaB006801@envy.delorie.com>
References: <200807070405 DOT m67451dZ010910 AT delorie DOT com>
<BAY139-W19808358F507B7930E7F6EE6940 AT phx DOT gbl>
<200807071920 DOT m67JKA4v032518 AT envy DOT delorie DOT com>
<BAY139-W3281EFF9FE7174C4D5C2FEE6940 AT phx DOT gbl>
<200807072141 DOT m67Lf1A6003751 AT envy DOT delorie DOT com>
<BAY139-W45413141F49024B6BBB218E6940 AT phx DOT gbl>
<200807072346 DOT m67NklaB006801 AT envy DOT delorie DOT com>
MIME-Version: 1.0
X-OriginalArrivalTime: 08 Jul 2008 01:28:18.0809 (UTC) FILETIME=[E6DF9690:01C8E099]
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

--_56ac5af7-ebda-4e62-bd57-c196aa22e7c0_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


  > > Jay=20
  > > You have to "cheat" in any case=2C like starting with a compiler and =
    > > linker from somewhere.    >      >   DJ   > Um=2C no. I do cross co=
mpilers starting with only a native compiler and     > the original sources=
. Note that writing cross development tools is my     > day job - I do this=
 all the time.  =20
Having a native compiler and linker I label "cheating".
You have to start somewhere -- from some binaries=2C that are runnable some=
where=2C not just source.
(Yes=2C I realize even starting with a native compiler/linker and a working=
 bootable computer is being spoiled.)
 > And many of the tests are "run this" tests=3B=20
I admit I have not taken any inventory of compile vs. link vs. run.
Um=2C given a preexisting djcrx=2C a sys-root=2C changing the writev test t=
obe "auto" is reasonable=2C right? I have to try it out of course=2C with v=
203and v204. And=2C if you (or others) very much prefer the existing assump=
tion=2CI could make it first test if it can link anything (just main(){})=
=2C and if not=2C use thecurrent default=2C and only if it is able to link =
anything=2C then use theresult of linking to writev as a test.
Or really=2C it could be like (psuedo code!)
  #  # DJGPP 2.04 has writev=2C 2.03 does not.  # Default to 2.04 and probe=
 for 2.03.  #  has_write=3Dtrue # default in case libc.a not present  sysro=
ot =3D prefix/target/sys-root # default sys-root    if use_sysroot !=3D "" =
&& use_sysroot !=3D yes      sysroot =3D use_sysroot # use specified sys-ro=
ot    if exist sys-root/lib/libc.a      # make sure it is minimally valid  =
    if nm-for-target libc.a | grep fopen        if nm-for-target libc.a | g=
rep writev          has_writev=3Dtrue        else          has_writev=3Dfal=
se
=20
If you have ld=2C you probably have nm.
No need to compile=2C except=2C well=2C maybe the compileris better at find=
ing libc.a.
=20
so maybe:
  has_writev=3Dtrue # assume v2.04 default in case libc.a not present  # Ca=
n we compile and link anything?  if cc << int main() { }<<    # Can we NOT =
link to writev?    if ! cc <<       int main() { void* p =3D &writev=3B }  =
  <<       has_writev=3Dfalse    else
      rm a.exe       rm a.out   else    echo WARNING: unable to do autoconf=
iguration via linking for cross build=2C using defaults.  end
=20
Really=2C this is pseudo code.I'll get the m4/auto*/sh right.
Also=2C maybe uname differentiates=2C though that's crude.Presumably 2.04 e=
xisted=2C in an intermediate state=2C beforewritev was added.
I believe there are other similar things being hardcoded here.I'll look int=
o it.
 - Jay=

--_56ac5af7-ebda-4e62-bd57-c196aa22e7c0_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<style>
.hmmessage P
{
margin:0px=3B
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt=3B
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class=3D'hmmessage'>
&nbsp=3B &gt=3B &gt=3B Jay <BR>
&nbsp=3B &gt=3B &gt=3B You have to "cheat" in any case=2C like starting wit=
h a compiler and&nbsp=3B&nbsp=3B <BR>&nbsp=3B &gt=3B &gt=3B linker from som=
ewhere.&nbsp=3B <BR>&nbsp=3B &gt=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B<BR>&nbs=
p=3B &gt=3B&nbsp=3B&nbsp=3B&nbsp=3BDJ <BR>&nbsp=3B &gt=3B Um=2C no. I do cr=
oss compilers starting with only a native compiler and&nbsp=3B&nbsp=3B <BR>=
&nbsp=3B &gt=3B the original sources. Note that writing cross development t=
ools is my&nbsp=3B&nbsp=3B <BR>&nbsp=3B &gt=3B day job - I do this all the =
time.&nbsp=3B&nbsp=3B <BR>
<BR>Having a native compiler and linker I label "cheating".<BR>
You have to start somewhere -- from some binaries=2C that are runnable some=
where=2C not just source.<BR>
(Yes=2C I realize even starting with a native compiler/linker and a working=
 bootable computer is being spoiled.)<BR>
<BR>&nbsp=3B&gt=3B And many of the tests are "run this" tests=3B <BR>
<BR>I admit I have not taken any inventory of compile vs. link vs. run.<BR>
<BR>Um=2C given a preexisting djcrx=2C a sys-root=2C changing the writev te=
st to<BR>be "auto" is reasonable=2C right? I have to try it out of course=
=2C with v203<BR>and v204. And=2C if you (or others) very much prefer the e=
xisting assumption=2C<BR>I could make it first test if it can link anything=
 (just main(){})=2C and if not=2C use the<BR>current default=2C and only if=
 it is able to link anything=2C then use the<BR>result of linking to writev=
 as a test.<BR>
<BR>Or really=2C it could be like (psuedo code!)<BR>
<BR>&nbsp=3B #<BR>&nbsp=3B # DJGPP 2.04 has writev=2C 2.03 does not.<BR>&nb=
sp=3B # Default to 2.04 and probe for 2.03.<BR>&nbsp=3B #<BR>&nbsp=3B has_w=
rite=3Dtrue # default in case libc.a not present<BR>&nbsp=3B sysroot =3D pr=
efix/target/sys-root # default sys-root<BR>&nbsp=3B&nbsp=3B&nbsp=3B if use_=
sysroot !=3D "" &amp=3B&amp=3B use_sysroot !=3D yes<BR>&nbsp=3B&nbsp=3B&nbs=
p=3B&nbsp=3B&nbsp=3B sysroot =3D use_sysroot # use specified sys-root<BR>&n=
bsp=3B&nbsp=3B&nbsp=3B if exist sys-root/lib/libc.a<BR>&nbsp=3B&nbsp=3B&nbs=
p=3B&nbsp=3B&nbsp=3B # make sure it is minimally valid<BR>&nbsp=3B&nbsp=3B&=
nbsp=3B&nbsp=3B&nbsp=3B if nm-for-target libc.a | grep fopen<BR>&nbsp=3B&nb=
sp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B if nm-for-target libc.a | gre=
p writev<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=
=3B&nbsp=3B has_writev=3Dtrue<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&n=
bsp=3B&nbsp=3B else<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbs=
p=3B&nbsp=3B&nbsp=3B has_writev=3Dfalse<BR>
&nbsp=3B<BR>
If you have ld=2C you probably have nm.<BR><BR>
No need to compile=2C except=2C well=2C maybe the compiler<BR>is better at =
finding libc.a.<BR>
&nbsp=3B<BR>
so maybe:<BR>
&nbsp=3B has_writev=3Dtrue # assume v2.04 default in case libc.a not presen=
t<BR>&nbsp=3B # Can we compile and link anything?<BR>&nbsp=3B if cc &lt=3B&=
lt=3B<BR>&nbsp=3Bint main() { }<BR>&lt=3B&lt=3B<BR>&nbsp=3B&nbsp=3B&nbsp=3B=
 # Can we NOT link to writev?<BR>&nbsp=3B&nbsp=3B&nbsp=3B if ! cc &lt=3B&lt=
=3B&nbsp=3B<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B int main() { void* =
p =3D &amp=3Bwritev=3B }<BR>&nbsp=3B&nbsp=3B&nbsp=3B &lt=3B&lt=3B <BR>&nbsp=
=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B has_writev=3Dfalse<BR>&nbsp=3B&nbsp=3B&=
nbsp=3B else<BR>
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B rm a.exe&nbsp=3B<BR>&nbsp=3B&nbsp=
=3B&nbsp=3B&nbsp=3B&nbsp=3B rm a.out&nbsp=3B<BR>&nbsp=3B else<BR>&nbsp=3B&n=
bsp=3B&nbsp=3B echo WARNING: unable to do autoconfiguration via linking for=
 cross build=2C using defaults.<BR>&nbsp=3B end<BR>
&nbsp=3B<BR>
Really=2C this is pseudo code.<BR>I'll get the m4/auto*/sh right.<BR>
<BR>Also=2C maybe uname differentiates=2C though that's crude.<BR>Presumabl=
y 2.04 existed=2C in an intermediate state=2C before<BR>writev was added.<B=
R>
<BR>I believe there are other similar things being hardcoded here.<BR>I'll =
look into it.<BR>
<BR>&nbsp=3B- Jay<BR><BR></body>
</html>=

--_56ac5af7-ebda-4e62-bd57-c196aa22e7c0_--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019