CT_PATCH_ORDER not defined

Yann E. MORIN yann.morin.1998@anciens.enib.fr
Sun Dec 19 16:45:00 GMT 2010

Heiko, All,

On Sunday 19 December 2010 17:01:56 Heiko Zuerker wrote:
> Quoting "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>:
> > On Saturday 18 December 2010 22:31:28 Heiko Zuerker wrote:
> >> I looked over the code and also couldn't find how or where the
> >> CT_PATCH_LOCAL_FALLBACK_BUNDLED is handled (I could simply be blind
> >> too).
> >
> > Does the attached fixes it for you?
> This one unfortunately does not work, since it would always try to  
> apply both patches.

It should not, as the two 'fallback' choices also select PATCH_SINGLE, and
scripts/functions@795 breaks the loop after the first directory found, if

I've just tried it here (with my previous patch applied), and it works as
expected. I've made a directory as such:
  mkdir ${HOME}/tmp/foo.patches
  cp -a patches/gcc ${HOME}/tmp/foo.patches/gcc

and configured crosstool-NG with:
  grep PATCH .config
  # CT_PATCH_BUNDLED is not set
  # CT_PATCH_LOCAL is not set
  # CT_PATCH_NONE is not set

Crostool-NG then properly uses built-in patches for all components, except
for gcc, for which it uses patches from ${HOME}/tmp/foo.patches, and only
that. If it had tried to also apply bundled patches, patch would have
complained about 'already applied or reversed' patch.

Snippet of the log file:

[EXTRA]    Patching 'mpfr-2.4.2'
[DEBUG]    Looking for patches in '/home/ymorin/tmp/foo.patches/mpfr/2.4.2'...
[DEBUG]    Looking for patches in '/home/ymorin/dev/crosstool-NG/ct-ng.current/patches/mpfr/2.4.2'...
[DEBUG]    Applying patch '/home/ymorin/dev/crosstool-NG/ct-ng.current/patches/mpfr/2.4.2/100-sin_cos_underfl
[DEBUG]    ==> Executing: 'patch --no-backup-if-mismatch -g0 -F1 -p1 -f'
[ALL  ]    patching file PATCHES
[ALL  ]    patching file VERSION
[EXTRA]    Patching 'gcc-4.4.3'
[DEBUG]    Looking for patches in '/home/ymorin/tmp/foo.patches/gcc/4.4.3'...
[DEBUG]    Applying patch '/home/ymorin/tmp/foo.patches/gcc/4.4.3/100-alpha-mieee-default.patch'
[DEBUG]    ==> Executing: 'patch --no-backup-if-mismatch -g0 -F1 -p1 -f'
[ALL  ]    patching file gcc/config/alpha/alpha.h
[ALL  ]    patching file gcc/config/alpha/alpha.opt
[DEBUG]    Applying patch '/home/ymorin/tmp/foo.patches/gcc/4.4.3/400-pr42289-fix-libffi-build-on-arm-oabi.pa
[DEBUG]    ==> Executing: 'patch --no-backup-if-mismatch -g0 -F1 -p1 -f'
[ALL  ]    patching file libffi/src/arm/sysv.S
[ALL  ]    Hunk #1 succeeded at 242 (offset 7 lines).
[ALL  ]    Overiding config.guess and config.sub

As you can see, for MPFR, it first test for a local patchset, which it does
not find, so reverts back to looking for a bundled patchset, which it does
find, and applies patches from there. While for gcc, it does find a local
patchset, applies patches from there, and does not even look if a bundled
patchset exists (hint: config.guess and .sub are after applying patches).

This is what PATCH_SINGLE is intended for.

> I attached a patch which works.

Did you even test my patch? It Works For Me (TM). ;-)

> The patch could be made much smaller, but I decided to rather make  
> sure others can read it.

That patch should not be needed, as the existing code does exactly what is
expected. Besides, the patch has a few shortcomings:
- it tests for directory existence using -e when it should use -d, which
  means it would believe a patch dir exists, when it is in fact a file (or
  a fifo, or whatever);
- it uses tabs instead of spaces (benign).

Yann E. MORIN.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

For unsubscribe information see http://sourceware.org/lists.html#faq

More information about the crossgcc mailing list