[oe-commits] [meta-openembedded] 50/54: tftp-hpa: Fix PIE build with clang

git at git.openembedded.org git at git.openembedded.org
Tue Aug 29 14:36:20 UTC 2017


This is an automated email from the git hooks/post-receive script.

martin_jansa pushed a commit to branch master-next
in repository meta-openembedded.

commit 78dae7775dd228b01dc36116aac4d7fbc5e354f8
Author: Khem Raj <raj.khem at gmail.com>
AuthorDate: Mon Aug 28 23:32:18 2017 -0700

    tftp-hpa: Fix PIE build with clang
    
    clang finds a name clash with libc and linker errors out like below
    
    tftpd.o: relocation R_ARM_REL32 against external or undefined symbol `__progname@@GLIBC_2.4' can not be used when making a PIE executable; recompile with -fPIC
    
    Signed-off-by: Khem Raj <raj.khem at gmail.com>
    Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
---
 .../0001-__progname-is-provided-by-libc.patch      | 62 ++++++++++++++++++++++
 .../recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb       |  1 +
 2 files changed, 63 insertions(+)

diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/0001-__progname-is-provided-by-libc.patch b/meta-networking/recipes-daemons/tftp-hpa/files/0001-__progname-is-provided-by-libc.patch
new file mode 100644
index 0000000..cead977
--- /dev/null
+++ b/meta-networking/recipes-daemons/tftp-hpa/files/0001-__progname-is-provided-by-libc.patch
@@ -0,0 +1,62 @@
+From 941038fc05be21202cab7a7a9434097fb55ecbe0 Mon Sep 17 00:00:00 2001
+From: Thorsten Glaser <tg at mirbsd.de>
+Date: Thu, 31 Jul 2014 16:29:41 +0930
+Subject: [PATCH] __progname[] is provided by libc
+
+Rename local variable to tftpd_progname to avoid a clash with glibc
+global symbols and work around Debian bug #519006 (Closes: #564052).
+
+[ hpa: specifically, double-underscore symbols in C are reserved for
+  the implementation, i.e. compiler/libc. ]
+
+Signed-off-by: Ron Lee <ron at debian.org>
+Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
+---
+ tftpd/tftpd.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
+index e247b97..5fec7bf 100644
+--- a/tftpd/tftpd.c
++++ b/tftpd/tftpd.c
+@@ -76,7 +76,7 @@ static int ai_fam = AF_INET;
+ #define TRIES   6               /* Number of attempts to send each packet */
+ #define TIMEOUT_LIMIT ((1 << TRIES)-1)
+ 
+-const char *__progname;
++const char *tftpd_progname;
+ static int peer;
+ static unsigned long timeout  = TIMEOUT;        /* Current timeout value */
+ static unsigned long rexmtval = TIMEOUT;       /* Basic timeout value */
+@@ -395,9 +395,9 @@ int main(int argc, char **argv)
+     /* basename() is way too much of a pain from a portability standpoint */
+ 
+     p = strrchr(argv[0], '/');
+-    __progname = (p && p[1]) ? p + 1 : argv[0];
++    tftpd_progname = (p && p[1]) ? p + 1 : argv[0];
+ 
+-    openlog(__progname, LOG_PID | LOG_NDELAY, LOG_DAEMON);
++    openlog(tftpd_progname, LOG_PID | LOG_NDELAY, LOG_DAEMON);
+ 
+     srand(time(NULL) ^ getpid());
+ 
+@@ -946,14 +946,14 @@ int main(int argc, char **argv)
+        syslog daemon gets restarted by the time we get here. */
+     if (secure && standalone) {
+         closelog();
+-        openlog(__progname, LOG_PID | LOG_NDELAY, LOG_DAEMON);
++        openlog(tftpd_progname, LOG_PID | LOG_NDELAY, LOG_DAEMON);
+     }
+ 
+ #ifdef HAVE_TCPWRAPPERS
+     /* Verify if this was a legal request for us.  This has to be
+        done before the chroot, while /etc is still accessible. */
+     request_init(&wrap_request,
+-                 RQ_DAEMON, __progname,
++                 RQ_DAEMON, tftpd_progname,
+                  RQ_FILE, fd,
+                  RQ_CLIENT_SIN, &from, RQ_SERVER_SIN, &myaddr, 0);
+     sock_methods(&wrap_request);
+-- 
+2.14.1
+
diff --git a/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb b/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb
index 0a418b9..fe8a32e 100644
--- a/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb
+++ b/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb
@@ -26,6 +26,7 @@ SRC_URI = "http://kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-${PV}.t
            file://add-error-check-for-disk-filled-up.patch \
            file://tftp-hpa-bug-fix-on-separated-CR-and-LF.patch \
            file://fix-writing-emtpy-file.patch \
+           file://0001-__progname-is-provided-by-libc.patch \
            file://tftpd-hpa.socket \
            file://tftpd-hpa.service \
 "

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list