diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2017-01-27 11:11:21 +0100 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-02-13 18:43:24 +0100 |
commit | 960acf856f49e65ed31e096aa5fb4aeed237172e (patch) | |
tree | 1f560d584fff372b91b38b6313282cc20f9a67d7 /meta-oe/recipes-support/multipath-tools | |
parent | ebef44963866d3231ccfe79d66d21c96ca0b4113 (diff) | |
download | meta-openembedded-960acf856f49e65ed31e096aa5fb4aeed237172e.tar.gz |
multipath-tools: fix building of shared objects
When -pie is in CFLAGS, it overrides the -shared compiler
flag, leading to link errors (undefined main) for shared
objects. Parameters must be ordered so that -shared comes
last.
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-support/multipath-tools')
-rw-r--r-- | meta-oe/recipes-support/multipath-tools/files/shared-libs-avoid-linking-.so-as-executable.patch | 49 | ||||
-rw-r--r-- | meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/multipath-tools/files/shared-libs-avoid-linking-.so-as-executable.patch b/meta-oe/recipes-support/multipath-tools/files/shared-libs-avoid-linking-.so-as-executable.patch new file mode 100644 index 000000000..ae6bb89a7 --- /dev/null +++ b/meta-oe/recipes-support/multipath-tools/files/shared-libs-avoid-linking-.so-as-executable.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From 4311856200480288494df8df737f71ea316592d0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Patrick Ohly <patrick.ohly@intel.com> | ||
3 | Date: Thu, 26 Jan 2017 15:28:34 +0100 | ||
4 | Subject: [PATCH] shared libs: avoid linking .so as executable | ||
5 | |||
6 | When the OE build systems sets CFLAGS including -pie, gcc overrides | ||
7 | the earlier -shared parameter and tries to link a binary, leading to | ||
8 | errors about missing functions like main(). | ||
9 | |||
10 | Reordering the parameters so that -shared comes after CFLAGS | ||
11 | fixes this. | ||
12 | |||
13 | Upstream-Status: Inappropriate [OE specific, -pie shouldn't be in CFLAGS?!] | ||
14 | |||
15 | Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> | ||
16 | --- | ||
17 | libmpathpersist/Makefile | 2 +- | ||
18 | libmultipath/Makefile | 2 +- | ||
19 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
20 | |||
21 | diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile | ||
22 | index c4ec1c5..790692a 100644 | ||
23 | --- a/libmpathpersist/Makefile | ||
24 | +++ b/libmpathpersist/Makefile | ||
25 | @@ -20,7 +20,7 @@ all: $(LIBS) | ||
26 | |||
27 | $(LIBS): | ||
28 | $(CC) -Wall -fPIC -c $(CFLAGS) *.c | ||
29 | - $(CC) -shared $(LIBDEPS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) | ||
30 | + $(CC) $(LIBDEPS) $(CFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) | ||
31 | ln -s $(LIBS) $(DEVLIB) | ||
32 | $(GZIP) mpath_persistent_reserve_in.3 > mpath_persistent_reserve_in.3.gz | ||
33 | $(GZIP) mpath_persistent_reserve_out.3 > mpath_persistent_reserve_out.3.gz | ||
34 | diff --git a/libmultipath/Makefile b/libmultipath/Makefile | ||
35 | index fc0f3d6..2287d91 100644 | ||
36 | --- a/libmultipath/Makefile | ||
37 | +++ b/libmultipath/Makefile | ||
38 | @@ -55,7 +55,7 @@ endif | ||
39 | all: $(LIBS) | ||
40 | |||
41 | $(LIBS): $(OBJS) | ||
42 | - $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) $(LIBDEPS) | ||
43 | + $(CC) $(LDFLAGS) $(CFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) | ||
44 | ln -sf $@ $(DEVLIB) | ||
45 | |||
46 | install: | ||
47 | -- | ||
48 | 2.11.0 | ||
49 | |||
diff --git a/meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb b/meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb index 6bd611895..2ab4dad23 100644 --- a/meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb +++ b/meta-oe/recipes-support/multipath-tools/multipath-tools_git.bb | |||
@@ -11,6 +11,7 @@ SRC_URI = "git://git.opensvc.com/multipath-tools/.git;protocol=http \ | |||
11 | file://always-use-libdevmapper-kpartx.patch \ | 11 | file://always-use-libdevmapper-kpartx.patch \ |
12 | file://do-not-link-libmpathpersist-to-TMPDIR.patch \ | 12 | file://do-not-link-libmpathpersist-to-TMPDIR.patch \ |
13 | file://0001-multipathd.service-Error-fix.patch \ | 13 | file://0001-multipathd.service-Error-fix.patch \ |
14 | file://shared-libs-avoid-linking-.so-as-executable.patch \ | ||
14 | " | 15 | " |
15 | # 0.5.0 | 16 | # 0.5.0 |
16 | # | 17 | # |