public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] scripts/glibc-eglibc.sh-common: broken symlinks created for nested multilib
@ 2012-09-21  4:42 David Holsgrove
  2012-09-25 21:55 ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: David Holsgrove @ 2012-09-21  4:42 UTC (permalink / raw)
  To: yann.morin.1998; +Cc: crossgcc

# HG changeset patch
# User David Holsgrove <david.holsgrove@xilinx.com>
# Date 1348202094 -36000
# Node ID 886f1bbadce3c2a5ea07a4a46ce140a5a04dc555
# Parent  d9ae5974b0bd4f111c00b38a4edd6656bd1f0226
scripts/glibc-eglibc.sh-common: broken symlinks created for nested multilib
dirs

glibc-eglibc.sh-common prepares a number of symlinks for use in building C
Library, which is iterated through for each multilib combo, however there is a
hardcoded number of backsteps in the symlink command which assumes the multi_dir
is only 1 directory deep.

This means we are creating broken symlinks for nested multilib dirs, eg;

  gcc configured with these multilibs (besides the default):
  -mxl-barrel-shift  -->  bs/
  -mxl-barrel-shift -mno-xl-soft-mul  -->  bs/m/
  -mxl-barrel-shift -mno-xl-soft-mul -mxl-multiply-high  -->  bs/m/mh/

  multi_dir=bs;      ln -sf "../lib/bs" "bs/lib"           <- Ok
  multi_dir=bs/m;    ln -sf "../lib/bs/m" "bs/m/lib"       <- Broken
  multi_dir=bs/m/mh; ln -sf "../lib/bs/m/mh" "bs/m/mh/lib" <- Broken

In the Final C Library step, we perform a "Fixing up multilib location" stage,
which in each loop removes its temporary multi_dir - a problem with nested
multilib dirs, as the first loop may be for 'bs' say, which will remove the
'bs' directory, and the nested dirs for bs/m, bs/m/mh along with it, before
they have gone through their own do_libc_backend_once iteration.

The solution I propose is similar to how the build-libc-${libc_mode}
directories are created - replacing '/' with '_' and having a flat structure
for these temp multi_dirs

Signed-off-by: "David Holsgrove" <david.holsgrove@xilinx.com>

diff -r d9ae5974b0bd -r 886f1bbadce3 scripts/build/libc/glibc-eglibc.sh-common
--- a/scripts/build/libc/glibc-eglibc.sh-common	Thu Sep 20 15:21:40 2012 +1000
+++ b/scripts/build/libc/glibc-eglibc.sh-common	Fri Sep 21 14:34:54 2012 +1000
@@ -77,6 +77,7 @@
     local multi_dir
     local multi_flags
     local extra_dir
+    local flat_dir
     local libc_headers libc_startfiles libc_full
     local hdr
     local arg
@@ -112,10 +113,11 @@
             extra_flags="$( echo "${multilib#*;}"       \
                             |${sed} -r -e 's/@/ -/g;'   \
                           )"
-            extra_dir="/${multi_dir}"
+            flat_dir="libc_${multi_dir//\//_}"
+            extra_dir="/${flat_dir}"
 
-            # glibc install its files in ${extra_dir}/{usr/,}lib
-            # while gcc expects them in {,usr/}lib/${extra_dir}.
+            # glibc install its files in /${flat_dir}/{usr/,}lib
+            # while gcc expects them in {,usr/}lib/${multi_dir}.
             # Prepare some symlinks so glibc installs in fact in
             # the proper place
             # We do it in the start-files step, so it is not needed
@@ -125,10 +127,10 @@
                 CT_Pushd "${CT_SYSROOT_DIR}"
                 CT_DoExecLog ALL mkdir -p "lib/${multi_dir}"        \
                                           "usr/lib/${multi_dir}"    \
-                                          "${multi_dir}"            \
-                                          "${multi_dir}/usr"
-                CT_DoExecLog ALL ln -sf "../lib/${multi_dir}" "${multi_dir}/lib"
-                CT_DoExecLog ALL ln -sf "../../usr/lib/${multi_dir}" "${multi_dir}/usr/lib"
+                                          "${flat_dir}"            \
+                                          "${flat_dir}/usr"
+                CT_DoExecLog ALL ln -sf "../lib/${multi_dir}" "${flat_dir}/lib"
+                CT_DoExecLog ALL ln -sf "../../usr/lib/${multi_dir}" "${flat_dir}/usr/lib"
                 CT_Popd
             fi
             libc_headers=
@@ -164,8 +166,8 @@
                         fi
                     done
                 done
-                # Remove the multi_dir now it is no longer useful
-                CT_DoExecLog DEBUG rm -rf "${CT_SYSROOT_DIR}/${multi_dir}"
+                # Remove the flat_dir now it is no longer useful
+                CT_DoExecLog DEBUG rm -rf "${CT_SYSROOT_DIR}/${flat_dir}"
             fi # libc_mode == final
 
             CT_EndStep

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scripts/glibc-eglibc.sh-common: broken symlinks created for nested multilib
  2012-09-21  4:42 [PATCH] scripts/glibc-eglibc.sh-common: broken symlinks created for nested multilib David Holsgrove
@ 2012-09-25 21:55 ` Yann E. MORIN
  2012-10-23 17:08   ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: Yann E. MORIN @ 2012-09-25 21:55 UTC (permalink / raw)
  To: crossgcc; +Cc: David Holsgrove

David, All,

On Friday 21 September 2012 06:42:38 David Holsgrove wrote:
> # HG changeset patch
> # User David Holsgrove <david.holsgrove@xilinx.com>
> # Date 1348202094 -36000
> # Node ID 886f1bbadce3c2a5ea07a4a46ce140a5a04dc555
> # Parent  d9ae5974b0bd4f111c00b38a4edd6656bd1f0226
> scripts/glibc-eglibc.sh-common: broken symlinks created for nested multilib
> dirs

libc/glibc-eglibc: fix symlinks for nested multilib dirs

> glibc-eglibc.sh-common prepares a number of symlinks for use in building C
> Library, which is iterated through for each multilib combo, however there is a
> hardcoded number of backsteps in the symlink command which assumes the multi_dir
> is only 1 directory deep.
> 
> This means we are creating broken symlinks for nested multilib dirs, eg;
> 
>   gcc configured with these multilibs (besides the default):
>   -mxl-barrel-shift  -->  bs/
>   -mxl-barrel-shift -mno-xl-soft-mul  -->  bs/m/
>   -mxl-barrel-shift -mno-xl-soft-mul -mxl-multiply-high  -->  bs/m/mh/
> 
>   multi_dir=bs;      ln -sf "../lib/bs" "bs/lib"           <- Ok
>   multi_dir=bs/m;    ln -sf "../lib/bs/m" "bs/m/lib"       <- Broken
>   multi_dir=bs/m/mh; ln -sf "../lib/bs/m/mh" "bs/m/mh/lib" <- Broken
> 
> In the Final C Library step, we perform a "Fixing up multilib location" stage,
> which in each loop removes its temporary multi_dir - a problem with nested
> multilib dirs, as the first loop may be for 'bs' say, which will remove the
> 'bs' directory, and the nested dirs for bs/m, bs/m/mh along with it, before
> they have gone through their own do_libc_backend_once iteration.
> 
> The solution I propose is similar to how the build-libc-${libc_mode}
> directories are created - replacing '/' with '_' and having a flat structure
> for these temp multi_dirs

In theory, I have nothing serious against your patch. Except I don't know
how to test it. Care to share a defconfig (ct-ng defconfig), please?

Regards,
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scripts/glibc-eglibc.sh-common: broken symlinks created for nested multilib
  2012-09-25 21:55 ` Yann E. MORIN
@ 2012-10-23 17:08   ` Yann E. MORIN
  0 siblings, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2012-10-23 17:08 UTC (permalink / raw)
  To: crossgcc; +Cc: David Holsgrove

David, All,

As you pointed me to this mesage in the "custom location" thread:

On Tuesday 25 September 2012 Yann E. MORIN wrote:
> On Friday 21 September 2012 06:42:38 David Holsgrove wrote:
> > # HG changeset patch
> > # User David Holsgrove <david.holsgrove@xilinx.com>
> > # Date 1348202094 -36000
> > # Node ID 886f1bbadce3c2a5ea07a4a46ce140a5a04dc555
> > # Parent  d9ae5974b0bd4f111c00b38a4edd6656bd1f0226
> > scripts/glibc-eglibc.sh-common: broken symlinks created for nested multilib
> > dirs
[--SNIP--]
> In theory, I have nothing serious against your patch. Except I don't know
> how to test it. Care to share a defconfig (ct-ng defconfig), please?

Care to expand on hos to test it, please? ;-)

Regards,
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-23 17:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-21  4:42 [PATCH] scripts/glibc-eglibc.sh-common: broken symlinks created for nested multilib David Holsgrove
2012-09-25 21:55 ` Yann E. MORIN
2012-10-23 17:08   ` Yann E. MORIN

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 read-only IMAP folder(s) and NNTP newsgroup(s).