All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/haproxy: fix static only build
@ 2020-07-24  4:59 Baruch Siach
  0 siblings, 0 replies; only message in thread
From: Baruch Siach @ 2020-07-24  4:59 UTC (permalink / raw)
  To: buildroot

Add a patch to avoid dlfcn.h use when the toolchain is static only.

Fixes:
http://autobuild.buildroot.net/results/98caf66e8a7f72ee24e4d39f3aab541f82310369/
http://autobuild.buildroot.net/results/3024eb48a026b1a91e39f7d996be3d7f50314762/
http://autobuild.buildroot.net/results/e6bbf1469926bde9057f270940d1455e0f758e0e/

Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 ...-fix-build-with-static-only-toolchai.patch | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 package/haproxy/0001-BUG-MEDIUM-tools-fix-build-with-static-only-toolchai.patch

diff --git a/package/haproxy/0001-BUG-MEDIUM-tools-fix-build-with-static-only-toolchai.patch b/package/haproxy/0001-BUG-MEDIUM-tools-fix-build-with-static-only-toolchai.patch
new file mode 100644
index 000000000000..7ae7a6cbfde1
--- /dev/null
+++ b/package/haproxy/0001-BUG-MEDIUM-tools-fix-build-with-static-only-toolchai.patch
@@ -0,0 +1,84 @@
+From 311df83437c4d578e35e5faca30c10da28c30323 Mon Sep 17 00:00:00 2001
+Message-Id: <311df83437c4d578e35e5faca30c10da28c30323.1595566447.git.baruch@tkos.co.il>
+From: Baruch Siach <baruch@tkos.co.il>
+Date: Fri, 24 Jul 2020 07:44:59 +0300
+Subject: [PATCH] BUG/MEDIUM: tools: fix build with static only toolchains
+
+uClibc toolchains built with no dynamic library support don't provide
+the dlfcn.h header. That leads to build failure:
+
+  CC      src/tools.o
+src/tools.c:15:10: fatal error: dlfcn.h: No such file or directory
+ #include <dlfcn.h>
+          ^~~~~~~~~
+Enable dladdr only when USE_DL is defined.
+
+Signed-off-by: Baruch Siach <baruch@tkos.co.il>
+---
+Upstream status:
+https://www.mail-archive.com/haproxy at formilux.org/msg37986.html
+
+ src/tools.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/tools.c b/src/tools.c
+index 1c664852ad73..0bd80f846d05 100644
+--- a/src/tools.c
++++ b/src/tools.c
+@@ -10,7 +10,7 @@
+  *
+  */
+ 
+-#ifdef __ELF__
++#if defined(__ELF__) && defined(USE_DL)
+ #define _GNU_SOURCE
+ #include <dlfcn.h>
+ #include <link.h>
+@@ -4410,7 +4410,7 @@ const char *get_exec_path()
+ 	return ret;
+ }
+ 
+-#ifdef __ELF__
++#if defined(__ELF__) && defined(USE_DL)
+ /* calls dladdr() or dladdr1() on <addr> and <dli>. If dladdr1 is available,
+  * also returns the symbol size in <size>, otherwise returns 0 there.
+  */
+@@ -4444,7 +4444,7 @@ static int dladdr_and_size(const void *addr, Dl_info *dli, size_t *size)
+  * The file name (lib or executable) is limited to what lies between the last
+  * '/' and the first following '.'. An optional prefix <pfx> is prepended before
+  * the output if not null. The file is not dumped when it's the same as the one
+- * that contains the "main" symbol, or when __ELF__ is not set.
++ * that contains the "main" symbol, or when __ELF__ && USE_DL are not set.
+  *
+  * The symbol's base address is returned, or NULL when unresolved, in order to
+  * allow the caller to match it against known ones.
+@@ -4472,7 +4472,7 @@ const void *resolve_sym_name(struct buffer *buf, const char *pfx, void *addr)
+ #endif
+ 	};
+ 
+-#ifdef __ELF__
++#if defined(__ELF__) && defined(USE_DL)
+ 	Dl_info dli, dli_main;
+ 	size_t size;
+ 	const char *fname, *p;
+@@ -4489,7 +4489,7 @@ const void *resolve_sym_name(struct buffer *buf, const char *pfx, void *addr)
+ 		}
+ 	}
+ 
+-#ifdef __ELF__
++#if defined(__ELF__) && defined(USE_DL)
+ 	/* Now let's try to be smarter */
+ 	if (!dladdr_and_size(addr, &dli, &size))
+ 		goto unknown;
+@@ -4529,7 +4529,7 @@ const void *resolve_sym_name(struct buffer *buf, const char *pfx, void *addr)
+ 		chunk_appendf(buf, "+%#lx", (long)(addr - dli.dli_fbase));
+ 		return NULL;
+ 	}
+-#endif /* __ELF__ */
++#endif /* __ELF__ && USE_DL */
+  unknown:
+ 	/* unresolved symbol from the main file, report relative offset to main */
+ 	if ((void*)addr < (void*)main)
+-- 
+2.27.0
+
-- 
2.27.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-24  4:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-24  4:59 [Buildroot] [PATCH] package/haproxy: fix static only build Baruch Siach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.