Skip to contentSkip to conversation

libhugetlbfs: avoid search host library path for cross compilation

PATCH In review [email protected] 1 participant 3 messages Aug 26, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libhugetlbfs: avoid search host library path for cross compilation

From: Kai Kang <[email protected]>

There was a patch fixing the same issue:
libhugetlbfs-avoid-search-host-library-path-for-cros.patch

but missed the elf_i386.xB*, this patch fixes for it.

---
 ...s-elf_i386-avoid-search-host-library-path.patch | 40 ++++++++++++++++++++++
 .../libhugetlbfs/libhugetlbfs_git.bb               |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-elf_i386-avoid-search-host-library-path.patch
meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-elf_i386-avoid-search-host-library-path.patch new file +40 -0
new file mode 100644
index 0000000..1566488
@@ -0,0 +1,40 @@
+From 889e52753d30179ba4ac940023cb4ed561436ab8 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <[email protected]>
+Date: Tue, 4 Nov 2014 00:49:11 -0800
+Subject: [PATCH] libhugetlbfs/elf_i386: avoid search host library path for cross compilation
+
+Upstream-Status: Inappropriate [cross compile specific]
+
+Signed-off-by: Jackie Huang <[email protected]>
+---
+ ldscripts/elf_i386.xB   |    1 -
+ ldscripts/elf_i386.xBDT |    1 -
+ 2 files changed, 2 deletions(-)
+
+diff --git a/ldscripts/elf_i386.xB b/ldscripts/elf_i386.xB
+index 43fe51c..eae0fa8 100644
+--- a/ldscripts/elf_i386.xB
++++ b/ldscripts/elf_i386.xB
+@@ -3,7 +3,6 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386",
+ 	      "elf32-i386")
+ OUTPUT_ARCH(i386)
+ ENTRY(_start)
+-SEARCH_DIR("/usr/i486-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
+ INPUT(-lhugetlbfs);
+ /* Do we need any of these for elf?
+    __DYNAMIC = 0;    */
+diff --git a/ldscripts/elf_i386.xBDT b/ldscripts/elf_i386.xBDT
+index d72aebe..3bac1b1 100644
+--- a/ldscripts/elf_i386.xBDT
++++ b/ldscripts/elf_i386.xBDT
+@@ -3,7 +3,6 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386",
+ 	      "elf32-i386")
+ OUTPUT_ARCH(i386)
+ ENTRY(_start)
+-SEARCH_DIR("/usr/i486-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
+ INPUT(-lhugetlbfs);
+ /* Do we need any of these for elf?
+    __DYNAMIC = 0;    */
+--
+1.7.9.5
+
meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb +1 -0
index a2d3922..ae5e46a 100644
@@ -17,6 +17,7 @@ SRC_URI = " \
     file://libhugetlbfs-avoid-search-host-library-path-for-cros.patch \
     file://tests-Makefile-install-static-4G-edge-testcases.patch \
     file://0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch \
+    file://libhugetlbfs-elf_i386-avoid-search-host-library-path.patch \
 "
 
 S = "${WORKDIR}/git"
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/2 libhugetlbfs: avoid using keyword restrict as var name

From: Kai Kang <[email protected]>

When compile with gcc 5.x, libhugetlbfs fails with:

| hugeutils.c: In function '__lh_hugetlbfs_setup_env':
| hugeutils.c:304:40: error: expected identifier or '(' before restrict'
|    char *p, *tok, *exe, buf[MAX_EXE+1], restrict[MAX_EXE];
|                                         ^

Rename variable to avoid using keyword restrict as variable name to fix it.

---
 ...ugetlbfs-avoid-using-restrict-as-var-name.patch | 34 ++++++++++++++++++++++
 .../libhugetlbfs/libhugetlbfs_git.bb               |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-avoid-using-restrict-as-var-name.patch
meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-avoid-using-restrict-as-var-name.patch new file +34 -0
new file mode 100644
index 0000000..b77cfe1
@@ -0,0 +1,34 @@
+Avoid using keyword restrict as variable name which causes error with gcc 5.x:
+
+| hugeutils.c: In function '__lh_hugetlbfs_setup_env':
+| hugeutils.c:304:40: error: expected identifier or '(' before 'restrict'
+|    char *p, *tok, *exe, buf[MAX_EXE+1], restrict[MAX_EXE];
+|                                         ^
+
+Upstream-Status: Pending
+
+Signed-off-by: Kai Kang <[email protected]>
+---
+diff --git a/hugeutils.c b/hugeutils.c
+index 53a7fbd..b9d7001 100644
+--- a/hugeutils.c
++++ b/hugeutils.c
+@@ -301,14 +301,14 @@ void hugetlbfs_setup_env()
+ 
+ 	env = getenv("HUGETLB_RESTRICT_EXE");
+ 	if (env) {
+-		char *p, *tok, *exe, buf[MAX_EXE+1], restrict[MAX_EXE];
++		char *p, *tok, *exe, buf[MAX_EXE+1], restricted[MAX_EXE];
+ 		int found = 0;
+ 
+ 		exe = get_exe_name(buf, sizeof buf);
+ 		DEBUG("Found HUGETLB_RESTRICT_EXE, this exe is \"%s\"\n", exe);
+-		strncpy(restrict, env, sizeof restrict);
+-		restrict[sizeof(restrict)-1] = 0;
+-		for (p = restrict; (tok = strtok(p, ":")) != NULL; p = NULL) {
++		strncpy(restricted, env, sizeof restricted);
++		restricted[sizeof(restricted)-1] = 0;
++		for (p = restricted; (tok = strtok(p, ":")) != NULL; p = NULL) {
+ 			DEBUG("  ...check exe match for \"%s\"\n",  tok);
+ 			if (strcmp(tok, exe) == 0) {
+ 				found = 1;
meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb +1 -0
index ae5e46a..b7cc416 100644
@@ -18,6 +18,7 @@ SRC_URI = " \
     file://tests-Makefile-install-static-4G-edge-testcases.patch \
     file://0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch \
     file://libhugetlbfs-elf_i386-avoid-search-host-library-path.patch \
+    file://libhugetlbfs-avoid-using-restrict-as-var-name.patch \
 "
 
 S = "${WORKDIR}/git"
Signature · 1 line
1.9.1
author
#2 lore raw
In reply to [email protected]

Forgot to add layer info. They are for layer meta-oe.

--Kai

Quoted 73 lines · On 2015年08月26日 09:25, [email protected] wrote:

From: Kai Kang <[email protected]>

There was a patch fixing the same issue:
libhugetlbfs-avoid-search-host-library-path-for-cros.patch

but missed the elf_i386.xB*, this patch fixes for it.

---
  ...s-elf_i386-avoid-search-host-library-path.patch | 40 ++++++++++++++++++++++
  .../libhugetlbfs/libhugetlbfs_git.bb               |  1 +
  2 files changed, 41 insertions(+)

create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-elf_i386-avoid-search-host-library-path.patch

meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-elf_i386-avoid-search-host-library-path.patch new file +40 -0
new file mode 100644
index 0000000..1566488
@@ -0,0 +1,40 @@
+From 889e52753d30179ba4ac940023cb4ed561436ab8 Mon Sep 17 00:00:00 2001
+From: Jackie Huang <[email protected]>
+Date: Tue, 4 Nov 2014 00:49:11 -0800
+Subject: [PATCH] libhugetlbfs/elf_i386: avoid search host library path for cross compilation
+
+Upstream-Status: Inappropriate [cross compile specific]
+
+Signed-off-by: Jackie Huang <[email protected]>
+---
+ ldscripts/elf_i386.xB   |    1 -
+ ldscripts/elf_i386.xBDT |    1 -
+ 2 files changed, 2 deletions(-)
+
+diff --git a/ldscripts/elf_i386.xB b/ldscripts/elf_i386.xB
+index 43fe51c..eae0fa8 100644
+--- a/ldscripts/elf_i386.xB
++++ b/ldscripts/elf_i386.xB
+@@ -3,7 +3,6 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386",
+ 	      "elf32-i386")
+ OUTPUT_ARCH(i386)
+ ENTRY(_start)
+-SEARCH_DIR("/usr/i486-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
+ INPUT(-lhugetlbfs);
+ /* Do we need any of these for elf?
+    __DYNAMIC = 0;    */
+diff --git a/ldscripts/elf_i386.xBDT b/ldscripts/elf_i386.xBDT
+index d72aebe..3bac1b1 100644
+--- a/ldscripts/elf_i386.xBDT
++++ b/ldscripts/elf_i386.xBDT
+@@ -3,7 +3,6 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386",
+ 	      "elf32-i386")
+ OUTPUT_ARCH(i386)
+ ENTRY(_start)
+-SEARCH_DIR("/usr/i486-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
+ INPUT(-lhugetlbfs);
+ /* Do we need any of these for elf?
+    __DYNAMIC = 0;    */
+--
+1.7.9.5
+
meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb +1 -0
index a2d3922..ae5e46a 100644
@@ -17,6 +17,7 @@ SRC_URI = " \
      file://libhugetlbfs-avoid-search-host-library-path-for-cros.patch \
      file://tests-Makefile-install-static-4G-edge-testcases.patch \
      file://0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch \
+    file://libhugetlbfs-elf_i386-avoid-search-host-library-path.patch \
  "
 
  S = "${WORKDIR}/git"
Signature · 2 lines
Regards,
Neil | Kai Kang