Skip to contentSkip to conversation

libaio: don't disable linking to the system libraries

PATCH In review Ross Burton 2 participants 3 messages Nov 6, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libaio: don't disable linking to the system libraries

For some reason that I don't understand (a decade-old attempt at optimisation?) libaio disables linkage to the system libraries. Enabling fortify means linking to the system libraries, so remove the existing addition of -lc for x86 (the problem also happens on at least PPC) and just link to the system libraries on all platforms.

Also remove the sed of src/Makefile as the build not respecting LDFLAGS has been fixed upstream.

---
 .../libaio/libaio/system-linkage.patch             | 37 ++++++++++++++++++++++
 meta/recipes-extended/libaio/libaio_0.3.110.bb     |  9 ++----
 2 files changed, 39 insertions(+), 7 deletions(-)
 create mode 100644 meta/recipes-extended/libaio/libaio/system-linkage.patch
meta/recipes-extended/libaio/libaio/system-linkage.patch new file +37 -0
new file mode 100644
index 0000000..0b1f475
@@ -0,0 +1,37 @@
+From 94bba6880b1f10c6b3bf33a17ac40935d65a81ae Mon Sep 17 00:00:00 2001
+From: Ross Burton <[email protected]>
+Date: Fri, 6 Nov 2015 15:19:46 +0000
+Subject: [PATCH] Don't remove the system libraries and startup files from
+ libaio, as in some build configurations these are required.  For example,
+ including conf/include/security_flags.inc on PPC results in:
+
+io_queue_init.os: In function `io_queue_init':
+tmp/work/ppce300c3-poky-linux/libaio/0.3.110-r0/libaio-0.3.110/src/io_queue_init.c:33:
+undefined reference to `__stack_chk_fail_local'
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <[email protected]>
+---
+ src/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index eadb336..56ab701 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -3,10 +3,10 @@ includedir=$(prefix)/include
+ libdir=$(prefix)/lib
+ 
+ CFLAGS ?= -g -fomit-frame-pointer -O2
+-CFLAGS += -nostdlib -nostartfiles -Wall -I. -fPIC
++CFLAGS += -Wall -I. -fPIC
+ SO_CFLAGS=-shared $(CFLAGS)
+ L_CFLAGS=$(CFLAGS)
+-LINK_FLAGS=
++LINK_FLAGS=$(LDFLAGS)
+ LINK_FLAGS+=$(LDFLAGS)
+ 
+ soname=libaio.so.1
+-- 
+2.1.4
+
meta/recipes-extended/libaio/libaio_0.3.110.bb +2 -7
index cbe29ce..2adfa0a 100644
@@ -11,18 +11,13 @@ SRC_URI = "${DEBIAN_MIRROR}/main/liba/libaio/libaio_${PV}.orig.tar.gz \
            file://destdir.patch \
            file://libaio_fix_for_x32.patch \
            file://libaio_fix_for_mips_syscalls.patch \
-"
+           file://system-linkage.patch \
+           "
 
 SRC_URI[md5sum] = "2a35602e43778383e2f4907a4ca39ab8"
 SRC_URI[sha256sum] = "e019028e631725729376250e32b473012f7cb68e1f7275bfc1bbcdd0f8745f7e"
 
 EXTRA_OEMAKE =+ "prefix=${prefix} includedir=${includedir} libdir=${libdir}"
-# Need libc for stack-protector's __stack_chk_fail_local() bounce function
-LDFLAGS_append_x86 = " -lc"
-
-do_configure () {
-    sed -i 's#LINK_FLAGS=.*#LINK_FLAGS=$(LDFLAGS)#' src/Makefile
-}
 
 do_install () {
     oe_runmake install DESTDIR=${D}
Signature · 1 line
2.1.4
#1 lore raw
Quoted 2 lines · Ross Burton

For some reason that I don't understand (a decade-old attempt at

optimisation?)

Quoted 1 line

libaio disables linkage to the system libraries. Enabling fortify means

linking

Quoted 1 line

to the system libraries, so remove the existing addition of -lc for x86

(the

Quoted 1 line

problem also happens on at least PPC) and just link to the system

libraries on

Quoted 3 lines

all platforms.

Also remove the sed of src/Makefile as the build not respecting LDFLAGS

has been

Quoted 1 line

fixed upstream.

It might be due to AS NEEDED becoming default in linker. That now the positions of command line Argument will matter.

Quoted 4 lines
---
 .../libaio/libaio/system-linkage.patch             | 37

++++++++++++++++++++++

Quoted 3 lines
 meta/recipes-extended/libaio/libaio_0.3.110.bb     |  9 ++----
 2 files changed, 39 insertions(+), 7 deletions(-)
 create mode 100644

meta/recipes-extended/libaio/libaio/system-linkage.patch

Review

Quoted 2 lines
(quoted diff) +0 -0

b/meta/recipes-extended/libaio/libaio/system-linkage.patch

meta/recipes-extended/libaio/libaio/system-linkage.patch line 5

Quoted 10 lines

new file mode 100644
index 0000000..0b1f475

meta/recipes-extended/libaio/libaio/system-linkage.patch new file +5 -0
@@ -0,0 +1,37 @@
+From 94bba6880b1f10c6b3bf33a17ac40935d65a81ae Mon Sep 17 00:00:00 2001
+From: Ross Burton <[email protected]>
+Date: Fri, 6 Nov 2015 15:19:46 +0000
+Subject: [PATCH] Don't remove the system libraries and startup files from
+ libaio, as in some build configurations these are required.  For

example,

meta/recipes-extended/libaio/libaio/system-linkage.patch line 8

Quoted 4 lines
meta/recipes-extended/libaio/libaio/system-linkage.patch new file +3 -0
+ including conf/include/security_flags.inc on PPC results in:
+
+io_queue_init.os: In function `io_queue_init':

+tmp/work/ppce300c3-poky-linux/libaio/0.3.110-r0/libaio-0.3.110/src/io_queue_init.c:33:

Quoted 12 lines
meta/recipes-extended/libaio/libaio/system-linkage.patch new file +12 -0
+undefined reference to `__stack_chk_fail_local'
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <[email protected]>
+---
+ src/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index eadb336..56ab701 100644
+--- a/src/Makefile
++++ b/src/Makefile

meta/recipes-extended/libaio/libaio/system-linkage.patch line 31

Quoted 10 lines
meta/recipes-extended/libaio/libaio/system-linkage.patch new file +10 -0
+@@ -3,10 +3,10 @@ includedir=$(prefix)/include
+ libdir=$(prefix)/lib
+
+ CFLAGS ?= -g -fomit-frame-pointer -O2
+-CFLAGS += -nostdlib -nostartfiles -Wall -I. -fPIC
++CFLAGS += -Wall -I. -fPIC
+ SO_CFLAGS=-shared $(CFLAGS)
+ L_CFLAGS=$(CFLAGS)
+-LINK_FLAGS=
++LINK_FLAGS=$(LDFLAGS)

Isnt this line redundant see the below line adds same

Review

Quoted 7 lines
meta/recipes-extended/libaio/libaio/system-linkage.patch new file +6 -0
+ LINK_FLAGS+=$(LDFLAGS)
+
+ soname=libaio.so.1
+--
+2.1.4
+
(quoted diff) +0 -0

b/meta/recipes-extended/libaio/libaio_0.3.110.bb

meta/recipes-extended/libaio/libaio_0.3.110.bb SRC_URI =

Quoted 4 lines

index cbe29ce..2adfa0a 100644

meta/recipes-extended/libaio/libaio_0.3.110.bb +0 -0
@@ -11,18 +11,13 @@ SRC_URI =

"${DEBIAN_MIRROR}/main/liba/libaio/libaio_${PV}.orig.tar.gz \

meta/recipes-extended/libaio/libaio_0.3.110.bb SRC_URI = "${DEBIAN_MIRROR}/main/liba/libaio/libaio_${PV}.orig.tar.gz \

Quoted 9 lines
meta/recipes-extended/libaio/libaio_0.3.110.bb +2 -1
            file://destdir.patch \
            file://libaio_fix_for_x32.patch \
            file://libaio_fix_for_mips_syscalls.patch \
-"
+           file://system-linkage.patch \
+           "
 
 SRC_URI[md5sum] = "2a35602e43778383e2f4907a4ca39ab8"
 SRC_URI[sha256sum] =

"e019028e631725729376250e32b473012f7cb68e1f7275bfc1bbcdd0f8745f7e"

meta/recipes-extended/libaio/libaio_0.3.110.bb SRC_URI = · line 19

Quoted 2 lines
meta/recipes-extended/libaio/libaio_0.3.110.bb +0 -0
 EXTRA_OEMAKE =+ "prefix=${prefix} includedir=${includedir}

libdir=${libdir}"

meta/recipes-extended/libaio/libaio_0.3.110.bb SRC_URI = · line 19

Quoted 1 line
meta/recipes-extended/libaio/libaio_0.3.110.bb +0 -1
-# Need libc for stack-protector's __stack_chk_fail_local() bounce

function

Quoted 16 lines
meta/recipes-extended/libaio/libaio_0.3.110.bb +0 -6
-LDFLAGS_append_x86 = " -lc"
-
-do_configure () {
-    sed -i 's#LINK_FLAGS=.*#LINK_FLAGS=$(LDFLAGS)#' src/Makefile
-}
 
 do_install () {
     oe_runmake install DESTDIR=${D}
--

2.1.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 2 lines · Khem Raj

It might be due to AS NEEDED becoming default in linker. That now the positions of command line Argument will matter.

The command line upstream uses -nostdlib so most distributions do something to make it build with fortify enabled: for example debian adds -lgcc -lc to the link. I'm not sure what the difference between -nostdlib -lgcc -lc and a normal link is, if there is a difference?

Quoted 2 lines

Isnt this line redundant see the below line adds same

Yes, bad hunk left from previous workings. I'll fix.

Ross