Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Oberhuber2017-05-25 20:26:53 +0000
committerArun Thondapu2017-05-29 17:03:01 +0000
commitc636cf26e8ae94def06ac84039f9dde6e85f5e5d (patch)
tree736d8e30cd44b58d4f9ba412796ae5f02419be96
parent13af9dee8d49f1c068d8bc8caaf3ec816f754a3a (diff)
downloadrt.equinox.framework-c636cf26e8ae94def06ac84039f9dde6e85f5e5d.tar.gz
rt.equinox.framework-c636cf26e8ae94def06ac84039f9dde6e85f5e5d.tar.xz
rt.equinox.framework-c636cf26e8ae94def06ac84039f9dde6e85f5e5d.zip
Bug 517013 - Avoid memcpy@GLIBC_2.14 dependency on Linux x86_64
On newer Linux x86_64 hosts like REL7, an optimized version of memcpy() is available in glibc and linked in by default. The drawback of linking that optimized version is, that the resulting binaries don't run any more on older Linux distributions like REL6 (where that optimized memcpy@GLIBC_2.14 is not available). This fix avoids the problem by replacing memcpy() with memmove() on Linux x86_64 hosts only. To be safe, it also compiles with -fno-builtin-memcpy -fno-builtin-memmove on Linux x86_64. See also bug 515155 for a very similar fix in SWT to support REL6. Change-Id: I39bc8d4975015eb52f35d3d02eae921bf6d66478 Signed-off-by: Martin Oberhuber <martin.oberhuber@windriver.com> Signed-off-by: Arun Thondapu <arunkumar.thondapu@in.ibm.com>
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/eclipse-memcpy.h23
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/eclipse.c2
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/eclipseMain.c2
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/eclipseShm.c2
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/eclipseUtil.c2
-rwxr-xr-x[-rw-r--r--]features/org.eclipse.equinox.executable.feature/library/gtk/build.sh7
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak2
7 files changed, 39 insertions, 1 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipse-memcpy.h b/features/org.eclipse.equinox.executable.feature/library/eclipse-memcpy.h
new file mode 100644
index 000000000..0489d32ee
--- /dev/null
+++ b/features/org.eclipse.equinox.executable.feature/library/eclipse-memcpy.h
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Martin Oberhuber (Wind River) - initial API and implementation
+ *******************************************************************************/
+#ifndef ECLIPSE_MEMMOVE_H
+#define ECLIPSE_MEMMOVE_H
+
+/* Bug 517013: Replace memcpy() by memmove() on Linux x86_64 */
+/* Must be included after memcpy / memmove system includes. */
+#if defined(LINUX) && defined(__x86_64__)
+# if defined(memcpy)
+# undef memcpy
+# endif
+# define memcpy memmove
+#endif
+
+#endif
diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipse.c b/features/org.eclipse.equinox.executable.feature/library/eclipse.c
index e927af2c9..fb01ab71c 100644
--- a/features/org.eclipse.equinox.executable.feature/library/eclipse.c
+++ b/features/org.eclipse.equinox.executable.feature/library/eclipse.c
@@ -168,6 +168,8 @@
#include <errno.h>
#include <ctype.h>
+#include "eclipse-memcpy.h"
+
#define MAX_PATH_LENGTH 2000
#define MAX_SHARED_LENGTH (16 * 1024)
diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipseMain.c b/features/org.eclipse.equinox.executable.feature/library/eclipseMain.c
index ec15fba60..62178b159 100644
--- a/features/org.eclipse.equinox.executable.feature/library/eclipseMain.c
+++ b/features/org.eclipse.equinox.executable.feature/library/eclipseMain.c
@@ -28,6 +28,8 @@
#include <locale.h>
#include <sys/stat.h>
+#include "eclipse-memcpy.h"
+
static _TCHAR* libraryMsg =
_T_ECLIPSE("The %s executable launcher was unable to locate its \n\
companion shared library.");
diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipseShm.c b/features/org.eclipse.equinox.executable.feature/library/eclipseShm.c
index 4fbb39be7..ab9bac7b6 100644
--- a/features/org.eclipse.equinox.executable.feature/library/eclipseShm.c
+++ b/features/org.eclipse.equinox.executable.feature/library/eclipseShm.c
@@ -137,6 +137,8 @@ int setSharedData(const _TCHAR* id, const _TCHAR* data) {
#include <sys/types.h>
#include <unistd.h>
+#include "eclipse-memcpy.h"
+
int createSharedData(char** id, int size) {
int shmid;
key_t key = getpid();
diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipseUtil.c b/features/org.eclipse.equinox.executable.feature/library/eclipseUtil.c
index c91c8cb52..66199f5ec 100644
--- a/features/org.eclipse.equinox.executable.feature/library/eclipseUtil.c
+++ b/features/org.eclipse.equinox.executable.feature/library/eclipseUtil.c
@@ -28,6 +28,8 @@
#include <strings.h>
#endif
+#include "eclipse-memcpy.h"
+
#define MAX_LINE_LENGTH 256
/* Is the given VM J9 */
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/build.sh b/features/org.eclipse.equinox.executable.feature/library/gtk/build.sh
index 19ac6ec0b..6cd9ca86e 100644..100755
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/build.sh
+++ b/features/org.eclipse.equinox.executable.feature/library/gtk/build.sh
@@ -10,6 +10,7 @@
# IBM Corporation - initial API and implementation
# Kevin Cornell (Rational Software Corporation)
# Martin Oberhuber (Wind River) - [176805] Support building with gcc and debug
+# Martin Oberhuber (Wind River) - [517013] Avoid memcpy@GLIBC_2.14 dependency
#*******************************************************************************
#
# Usage: sh build.sh [<optional switches>] [clean]
@@ -253,6 +254,12 @@ elif [ "$defaultOS" = "solaris" ]; then
M_ARCH=-m64
export M_ARCH
fi
+elif [ "$defaultOS" = "linux" ]; then
+ if [ "$defaultOSArch" = "x86_64" ]; then
+ # Bug 517013: Avoid using memcpy() to remain compatible with older glibc
+ M_CFLAGS="-fno-builtin-memcpy -fno-builtin-memmove"
+ export M_CFLAGS
+ fi
fi
LIBRARY_DIR="$EXEC_DIR/../org.eclipse.equinox.launcher.$defaultWS.$defaultOS.$defaultOSArch"
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak b/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak
index 6abe01702..e20823478 100644
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak
+++ b/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak
@@ -48,7 +48,7 @@ GTK_LIBS = \
-DGTK3_LIB="\"libgtk-3.so.0\"" -DGDK3_LIB="\"libgdk-3.so.0\"" \
-DPIXBUF_LIB="\"libgdk_pixbuf-2.0.so.0\"" -DGOBJ_LIB="\"libgobject-2.0.so.0\"" -DX11_LIB="\"libX11.so.6\""
LFLAGS = ${M_ARCH} -shared -fpic -Wl,--export-dynamic
-CFLAGS = ${M_ARCH} -g -s -Wall\
+CFLAGS = ${M_CFLAGS} ${M_ARCH} -g -s -Wall\
-fpic \
-DLINUX \
-DMOZILLA_FIX \

Back to the top