Go to file
Thomas De Schampheleire d4d4056e63 toolchain/toolchain-external: restrict copying of dynamic loader to ld*.so.*
Commit 32bec8ee2f
("toolchain-external: copy ld*.so* for all C libraries") changed (among
other things) the glob pattern to catch the dynamic loader from
    ld*.so.*
to
    ld*.so*

thus now matching files like 'ld-2.20.so' in addition to files like
'ld.so.1'.

However, there is no apparent reason why that change was made. It is
not explicitly mentioned in the commit message as to why that would be
needed, nor is clear based on the rest of the changes in that
commit. But it turns out that it causes too many files to be copied
with some toolchains.

In most toolchains, the structure looks like this:

-rwxr-xr-x 1 tdescham tdescham 834364 Feb 16 21:23 output/target/lib/ld-2.16.so
lrwxrwxrwx 1 tdescham tdescham     10 Feb 16 21:23 output/target/lib/ld.so.1 -> ld-2.16.so

So, a symlink 'ld.so.1' which points to another file. Applications
would have 'ld.so.1' (the link) encoded as program interpreter
(readelf -l <program>, see INTERP entry)

The patterns like 'ld*.so*' are passed as argument to
copy_toolchain_lib_root which is defined in toolchain/helpers.mk.
This macro copy_toolchain_lib_root will find all files/links matching
the pattern. If a match is a regular file, it is simply copied. If it
is a symbolic link, the link is copied and then the logic is
recursively repeated on the link destination. That destination could
either again be a link or a regular file. In the first case we recurse
again, in the latter we stop and continue with the next match of the
pattern.

The problem this patch is solving is when a toolchain does not have
this structure with a link and a real file, but rather two actual
files:

-rwxr-xr-x 1 tdescham tdescham 170892 Feb 16 21:55 output/target/lib/ld-2.20.so
-rwxr-xr-x 1 tdescham tdescham 170892 Feb 16 21:55 output/target/lib/ld.so.1

In this case the pattern 'ld*.so*' would find two regular file matches
and copy both. On the other hand, the pattern 'ld*.so.*' would only
find the 'ld.so.1' file and copy just that. This saves about 170K in
rootfs size.

Closer inspection reveals that this particular toolchain has more such
dedoubled symbolic links, e.g. the standard pattern of
'usr/lib/libfoo.so -> libfoo.so.1 -> libfoo.so.1.0.2' is not present,
and each of these three components are real files. In any case, it is
obvious that the toolchain itself is 'broken'.

That being said, because we have the logic that recursively resolves
symbolic links, TOOLCHAIN_EXTERNAL_LIBS really only needs to contain
the "initial" name of the library to be copied.

Therefore, revert the glob pattern back to what it was.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
[Thomas: improve the commit log with the additional details from Thomas]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-10-27 14:52:44 +01:00
arch
board configs/stm32mp157_dk: rename to the sm32mp157c_dk2 2019-10-27 14:09:56 +01:00
boot
configs configs/stm32mp157_dk: rename to the sm32mp157c_dk2 2019-10-27 14:09:56 +01:00
docs core/legal-info: don't require overriding _LICENSE 2019-10-27 10:35:06 +01:00
fs fs: don't use := when not needed 2019-10-27 10:35:06 +01:00
linux
package package/meson: install cross-compilation.conf during toolchain install 2019-10-27 14:34:25 +01:00
support support/scripts/genimage.sh: pass an empty rootpath to genimage 2019-10-27 12:19:32 +01:00
system
toolchain toolchain/toolchain-external: restrict copying of dynamic loader to ld*.so.* 2019-10-27 14:52:44 +01:00
utils utils/check-package: report := that appends to variables 2019-10-27 10:35:06 +01:00
.defconfig
.flake8
.gitignore
.gitlab-ci.yml configs/stm32mp157_dk: rename to the sm32mp157c_dk2 2019-10-27 14:09:56 +01:00
.gitlab-ci.yml.in
CHANGES
Config.in packages: host gcc >= 4.8 is now guaranteed 2019-10-27 10:00:29 +01:00
Config.in.legacy
COPYING
DEVELOPERS configs/stm32mp157_dk: rename to the sm32mp157c_dk2 2019-10-27 14:09:56 +01:00
Makefile core: drop check-uniq-files 2019-10-26 21:19:07 +02:00
Makefile.legacy
README

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on Freenode IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches