Commit Graph

13 Commits

Author SHA1 Message Date
Tyler Hall b578a06564 image-mklibs: handle position independent binaries
Executables built with -fpie have the ELF type DYN rather than EXEC
which makes them difficult to distinguish from shared libraries.
Currently when building the list of executables we omit these binaries
so they might fail to run on the resultant rootfs due to missing
symbols. One of these is systemd which builds -fpie unconditionally, so
mklibs breaks images containing systemd.

Modify the search to catch all executable files that are ELF and have an
interpreter set. Omit libc and libpthread as special cases because they
have an interpreter and are directly executable but treating them as
such is antithetical to the pupose of mklibs.

(From OE-Core rev: 30da34ef032d5b4b2f694743715f2c8d64dd9849)

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-10 23:13:54 +00:00
Richard Purdie ae85c4b9a6 linuxloader/image-prelink/image-mklibs: Fix non-standard path prelinking
Prelinking on x86-64 wasn't working out the box as it uses /lib and
not /lib64 for libs. Prelink was refusing to link as the dynamic loader
didn't match its idea of the right path. Passing in the --dyanmic-linker
option avoids this.

We can share code from image-mklibs so abstract that into a new class,
linuxloader.bbclass.

This does break prelinking of multilib images, I've opened a bug so we
can loop back and fix that problem, the code would need to iterate the
dynamic loaders (and setup ld.so.conf files for it).

(From OE-Core rev: 7c3f2f61536cc8e0322087558cdcfe29ee2fac6d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-07 00:11:40 +00:00
Andre McCurdy 022f8cc7eb image-mklibs.bbclass: update i586 TARGET_ARCH test to i*86
(From OE-Core rev: 5ed4332eeb96beff53242942a1eb878ab4831847)

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-10-27 07:24:27 +00:00
Khem Raj 55d66edd36 mklibs: Fix loader for mipsel
Additionally treat ld.so to be searched in sysroot

Change-Id: I8b4acb821d9855a1163c7149bc8e369c7c438856
(From OE-Core rev: 4cf539e67333ba2c3fe924b092e104da53e68ca0)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-10-30 13:01:21 +00:00
Richard Purdie 1588b02d14 image/image-prelink/image-mklibs/sanity: Drop pointless EXPORT_FUNCTIONS
I'm sick of seeing people adding to EXPORT_FUNCTIONS in these classes
when they clearly have no idea what it does.

Worse, these uses of it are all broken, the naming is incorrect and
they do nothing. Lets remove them and try and preserve any remaining
part of my sanity.

(From OE-Core rev: 05a2fb19f722652c5d13be911b8ed45a264bbb40)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-01 23:37:01 +01:00
Nicolas Dechesne 6cdecac4ef image-mklibs: ensure sysroot is correctly set when calling gcc
[YOCTO #2519]

When getting gcc from sstate, it is possible to get a gcc with a bogus
sysroot configuration, as discussed in [1] or in [YOCTO #2519].

mklibs script will eventually call gcc, so we need to make sure that it
provides gcc with the right sysroot location.

[1] http://lists.openembedded.org/pipermail/openembedded-core/2013-September/084159.html

(From OE-Core rev: 3a66dd762e493ad2cda57110be67c3b06628050a)

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-03 17:45:52 +00:00
Lei Liu 6eb26f7865 image-mklibs: Fix grep pattern when mklibs collects executables in rootfs
File command in some version could print extra space between
"LSB" and "executable" - it causes mklibs can't find any executables
using grep "LSB executable".  Fix the grep pattern to catch
multiple spaces.

(From OE-Core rev: a52ef8c5dcd71f39bb48c71fb868cc0db662560e)

Signed-off-by: Lei Liu <lei.liu2@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-12 16:00:27 +00:00
Jesse Zhang d6ef548c48 image-mklibs: pass correct libdir to mklibs
libdir should be specified, or else mklibs won't work for 64bit targets.
It wouldn't be able to find the libs.

    Traceback (most recent call last):
      File "<build>/bitbake_build/tmp/sysroots/i686-linux/usr/bin/x86_64-wrs-linux/mklibs", line 553, in <module>
        header = elf_header(find_lib(libraries.copy().pop()))
      File "<build>/bitbake_build/tmp/sysroots/i686-linux/usr/bin/x86_64-wrs-linux/mklibs", line 89, in elf_header
        raise Exception("Cannot find lib: " + obj)
    Exception: Cannot find lib:

(From OE-Core rev: d2cd2ccea8bc4d110647ba3bd202772e5407000a)

Signed-off-by: Jesse Zhang <sen.zhang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-07 12:56:34 +01:00
Richard Purdie 5797feac5f image-mklibs/package_ipk: Remove bashisms
We now support using dash but these bashisms triggered build failures for me
when using it. This replaces the code with something which works on dash.

(From OE-Core rev: 4a85312568a6bb052cc511c15b4ae842ff7f8e59)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-05 22:26:25 +00:00
Kumar Gala acfcc85da0 image-mklibs.bbclass: Utilize ${base_libdir} instead of static /lib
We might redefine ${base_libdir} from being set to just /lib.

(From OE-Core rev: 7615f81f86bb5ccfe52b84b38eb9ae80a852d214)

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-08-05 17:16:02 +01:00
Kumar Gala 05f8db8bf9 image-mklibs.bbclass: Add powerpc64 arch support
powerp64 dynamic loader is 'ld64.so.1'.

(From OE-Core rev: ef6007cf129a6eec71e1cbb1c65efc8bfd3991e0)

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-08-05 17:16:01 +01:00
Adrian Alonso 9f2d50ccf0 image-mklibs: add microblaze arch support
* In function mklibs_optimize_image_doit
* Add microblaze arch case for setting the dynamic_loader
  used by "mklibs" call

(From OE-Core rev: 473314d9978dfee53cddc45e4ee1863266eb01e1)

Signed-off-by: Adrian Alonso <aalonso@secretlab.ca>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-10 09:56:20 +01:00
Nitin A Kamble 068417289a image-mklibs.bbclass: add the library optimization functionality
If you want to enable the mklibs library size optimization for your image
then, edit the MKLIBS_OPTIMIZED_IMAGES line in the local.conf like this:

  MKLIBS_OPTIMIZED_IMAGES ?= "poky-image-minimal your-own-image"

Also this will enable the mklibs library size optimization for all images.

  MKLIBS_OPTIMIZED_IMAGES ?= "all"

on qemux86 machine this reduced the rootfs size of poky image-minimal
image from 7.9MB to 7.2MB. That is around 11% image foot print reduction.
That image had 38 elf executables. Generally the size optimization by
mklibs is reversely proportional to the number of elf executables in the
rootfs. So bigger images will see less optimization, and smaller images
will see large image size reductions.

Thanks to mark hatle for his help in implementation of this.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
2011-02-09 22:45:47 +00:00