diff options
-rw-r--r-- | meta-oe/recipes-benchmark/libhugetlbfs/files/Force-text-segment-alignment-to-0x08000000-for-i386-.patch | 92 | ||||
-rw-r--r-- | meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb | 3 |
2 files changed, 94 insertions, 1 deletions
diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/files/Force-text-segment-alignment-to-0x08000000-for-i386-.patch b/meta-oe/recipes-benchmark/libhugetlbfs/files/Force-text-segment-alignment-to-0x08000000-for-i386-.patch new file mode 100644 index 0000000000..ce6974d7c1 --- /dev/null +++ b/meta-oe/recipes-benchmark/libhugetlbfs/files/Force-text-segment-alignment-to-0x08000000-for-i386-.patch | |||
@@ -0,0 +1,92 @@ | |||
1 | From 3c6f8d0e3c0694f79244ec6ad5ad9ba3ca26bc0a Mon Sep 17 00:00:00 2001 | ||
2 | From: Yang Shi <yang.shi@linaro.org> | ||
3 | Date: Mon, 7 Dec 2015 14:12:13 -0800 | ||
4 | Subject: [PATCH] Force text segment alignment to 0x08000000 for i386 with gold | ||
5 | linker | ||
6 | |||
7 | Upstream-Status: Backport | ||
8 | |||
9 | When build libhugetlbfs tests with gold linker for i386, the below error occurs: | ||
10 | |||
11 | i586-oe-linux-gcc -m32 -march=i586 -Wl,-O1 -Wl,--hash-style=gnu | ||
12 | -Wl,--as-needed | ||
13 | --sysroot=/home/jenkins/oe/world/shr-core/tmp-glibc/sysroots/qemux86 -I.. | ||
14 | -O2 | ||
15 | -Wall -g -o obj32/linkhuge_rw.o -c linkhuge_rw.c | ||
16 | | i586-oe-linux-gcc -m32 -march=i586 -Wl,-O1 -Wl,--hash-style=gnu | ||
17 | -Wl,--as-needed | ||
18 | --sysroot=/home/jenkins/oe/world/shr-core/tmp-glibc/sysroots/qemux86 | ||
19 | -B./obj32 | ||
20 | -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,noexecstack -ldl | ||
21 | -L../obj32 | ||
22 | -o obj32/linkhuge_rw -Wl,--no-as-needed -lpthread -ldl -lhugetlbfs_privutils | ||
23 | -Wl,--hugetlbfs-align obj32/linkhuge_rw.o obj32/testutils.o | ||
24 | | i586-oe-linux-ld: internal error in do_write, at | ||
25 | /home/jenkins/oe/world/shr-core/tmp-glibc/work/x86_64-oe-linux/binutils-cross-i586/2.25-r0/git/gold/output.cc:464 | ||
26 | | collect2: error: ld returned 1 exit status | ||
27 | |||
28 | But, it works well with GNU linker. --hugetlbfs-align flag passes | ||
29 | "-zcommon-page-size=$SLICE_SIZE -zmax-page-size=$SLICE_SIZE", that are supported by gold linker too. | ||
30 | But, it looks gold linker deal with them in a different way from gnu linker for i586. | ||
31 | |||
32 | The readelf shows the below result with GNU linker: | ||
33 | |||
34 | Elf file type is EXEC (Executable file) | ||
35 | Entry point 0x8048fbd | ||
36 | There are 8 program headers, starting at offset 52 | ||
37 | |||
38 | Program Headers: | ||
39 | Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align | ||
40 | PHDR 0x000034 0x08000034 0x08000034 0x00100 0x00100 R E 0x4 | ||
41 | INTERP 0x048134 0x08048134 0x08048134 0x00013 0x00013 R 0x1 | ||
42 | [Requesting program interpreter: /lib/ld-linux.so.2] | ||
43 | LOAD 0x000000 0x08000000 0x08000000 0x5a5bc 0x5a5bc R E 0x400000 | ||
44 | LOAD 0x05a5bc 0x0845a5bc 0x0845a5bc 0x1028c 0x202cc RW 0x400000 | ||
45 | DYNAMIC 0x05a5d0 0x0845a5d0 0x0845a5d0 0x000e8 0x000e8 RW 0x4 | ||
46 | NOTE 0x048148 0x08048148 0x08048148 0x00044 0x00044 R 0x4 | ||
47 | GNU_EH_FRAME 0x059e5c 0x08059e5c 0x08059e5c 0x0009c 0x0009c R 0x4 | ||
48 | GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10 | ||
49 | |||
50 | "--relax" linker option doesn't solve this problem. | ||
51 | Forced textsegment alignment to 0x08000000 with gold linker, the build will pass and | ||
52 | readelf shows the same result with GNU linker: | ||
53 | |||
54 | Elf file type is EXEC (Executable file) | ||
55 | Entry point 0x8048fbd | ||
56 | There are 8 program headers, starting at offset 52 | ||
57 | |||
58 | Program Headers: | ||
59 | Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align | ||
60 | PHDR 0x000034 0x08000034 0x08000034 0x00100 0x00100 R E 0x4 | ||
61 | INTERP 0x048134 0x08048134 0x08048134 0x00013 0x00013 R 0x1 | ||
62 | [Requesting program interpreter: /lib/ld-linux.so.2] | ||
63 | LOAD 0x000000 0x08000000 0x08000000 0x5a5bc 0x5a5bc R E 0x400000 | ||
64 | LOAD 0x05a5bc 0x0845a5bc 0x0845a5bc 0x1028c 0x202cc RW 0x400000 | ||
65 | DYNAMIC 0x05a5d0 0x0845a5d0 0x0845a5d0 0x000e8 0x000e8 RW 0x4 | ||
66 | NOTE 0x048148 0x08048148 0x08048148 0x00044 0x00044 R 0x4 | ||
67 | GNU_EH_FRAME 0x059e5c 0x08059e5c 0x08059e5c 0x0009c 0x0009c R 0x4 | ||
68 | GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10 | ||
69 | |||
70 | The fix just have impact on hugelink_rw test case, which needs --hugetlbfs-align flag. | ||
71 | |||
72 | Signed-off-by: Yang Shi <yang.shi@linaro.org> | ||
73 | Signed-off-by: Eric B Munson <emunson@mgebm.net> | ||
74 | --- | ||
75 | ld.hugetlbfs | 1 + | ||
76 | 1 file changed, 1 insertion(+) | ||
77 | |||
78 | diff --git a/ld.hugetlbfs b/ld.hugetlbfs | ||
79 | index 4417442..32bc6fb 100755 | ||
80 | --- a/ld.hugetlbfs | ||
81 | +++ b/ld.hugetlbfs | ||
82 | @@ -98,6 +98,7 @@ if [ "$HTLB_ALIGN" == "slice" ]; then | ||
83 | # otherwise it will be NULL. | ||
84 | case "$EMU" in | ||
85 | armelf*_linux_eabi) HTLBOPTS="$HTLBOPTS -Ttext-segment=$SLICE_SIZE" ;; | ||
86 | + elf_i386) HTLBOPTS="$HTLBOPTS -Ttext-segment=0x08000000" ;; | ||
87 | esac | ||
88 | fi | ||
89 | |||
90 | -- | ||
91 | 2.0.2 | ||
92 | |||
diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb b/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb index 015d4463a5..accbffdfd7 100644 --- a/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb +++ b/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb | |||
@@ -19,11 +19,12 @@ SRC_URI = " \ | |||
19 | file://0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch \ | 19 | file://0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch \ |
20 | file://libhugetlbfs-elf_i386-avoid-search-host-library-path.patch \ | 20 | file://libhugetlbfs-elf_i386-avoid-search-host-library-path.patch \ |
21 | file://libhugetlbfs-avoid-using-restrict-as-var-name.patch \ | 21 | file://libhugetlbfs-avoid-using-restrict-as-var-name.patch \ |
22 | file://Force-text-segment-alignment-to-0x08000000-for-i386-.patch \ | ||
22 | " | 23 | " |
23 | 24 | ||
24 | S = "${WORKDIR}/git" | 25 | S = "${WORKDIR}/git" |
25 | 26 | ||
26 | COMPATIBLE_HOST = "(x86_64|powerpc|powerpc64|aarch64|arm).*-linux*" | 27 | COMPATIBLE_HOST = "(i.86|x86_64|powerpc|powerpc64|aarch64|arm).*-linux*" |
27 | 28 | ||
28 | LIBARGS = "LIB32=${baselib} LIB64=${baselib}" | 29 | LIBARGS = "LIB32=${baselib} LIB64=${baselib}" |
29 | LIBHUGETLBFS_ARCH = "${TARGET_ARCH}" | 30 | LIBHUGETLBFS_ARCH = "${TARGET_ARCH}" |