Andrew Geissler | a2681d9 | 2020-10-16 10:17:07 -0500 | [diff] [blame] | 1 | From 0a163f60b4a316c4b6f1726a71c84755f3bd85e7 Mon Sep 17 00:00:00 2001 |
| 2 | From: Martin Jansa <martin.jansa@lge.com> |
| 3 | Date: Wed, 16 Sep 2020 04:36:04 -0700 |
| 4 | Subject: [PATCH] Revert "ld.hugetlbfs: fix -Ttext-segment argument on AArch64" |
| 5 | |
| 6 | This reverts commit 852dcc963ce44861ed7c4e225aa92ff2b5b43579. |
| 7 | |
| 8 | * works around |
| 9 | ERROR: libhugetlbfs-1_2.23-r0 do_populate_sysroot: Fatal errors occurred in subprocesses: |
| 10 | Command '['arm-oe-linux-gnueabi-strip', '--remove-section=.comment', '--remove-section=.note', 'libhugetlbfs/1_2.23-r0/sysroot-destdir/usr/lib/libhugetlbfs/tests/obj32/linkhuge_rw']' returned non-zero exit status 1. |
| 11 | Subprocess output:arm-oe-linux-gnueabi-strip: |
| 12 | libhugetlbfs/1_2.23-r0/sysroot-destdir/usr/lib/libhugetlbfs/tests/obj32/stmuFa58: error: PHDR segment not covered by LOAD segment |
| 13 | arm-oe-linux-gnueabi-strip: libhugetlbfs/1_2.23-r0/sysroot-destdir/usr/lib/libhugetlbfs/tests/obj32/stmuFa58[.interp]: file format not recognized |
| 14 | |
| 15 | I don't see anything suspicious in the build (the same cmdline as in 2.22 |
| 16 | version), but it uses |
| 17 | |
| 18 | libhugetlbfs/1_2.22-r0-old/temp/log.do_compile:arm-oe-linux-gnueabi-gcc |
| 19 | -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 -Wl,-O1 |
| 20 | -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now |
| 21 | -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security |
| 22 | -Werror=format-security -Werror=return-type |
| 23 | --sysroot=/jenkins/mjansa/build/ros/oe-melodic-gatesgarth/libhugetlbfs/1_2.22-r0/recipe-sysroot |
| 24 | -I.. -O2 -Wall -g -o obj32/linkhuge_rw.o -c linkhuge_rw.c |
| 25 | libhugetlbfs/1_2.22-r0-old/temp/log.do_compile:arm-oe-linux-gnueabi-gcc |
| 26 | -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 -Wl,-O1 |
| 27 | -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now |
| 28 | -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security |
| 29 | -Werror=format-security -Werror=return-type |
| 30 | --sysroot=/jenkins/mjansa/build/ros/oe-melodic-gatesgarth/libhugetlbfs/1_2.22-r0/recipe-sysroot |
| 31 | -B./obj32 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now |
| 32 | -ldl -L../obj32 -o obj32/linkhuge_rw -Wl,--no-as-needed -lpthread -ldl |
| 33 | -lhugetlbfs_privutils -Wl,--hugetlbfs-align obj32/linkhuge_rw.o |
| 34 | obj32/testutils.o |
| 35 | libhugetlbfs/1_2.23-r0-new/temp/log.do_compile:arm-oe-linux-gnueabi-gcc |
| 36 | -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 -Wl,-O1 |
| 37 | -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now |
| 38 | -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security |
| 39 | -Werror=format-security -Werror=return-type |
| 40 | --sysroot=/jenkins/mjansa/build/ros/oe-melodic-gatesgarth/libhugetlbfs/1_2.23-r0/recipe-sysroot |
| 41 | -I.. -O2 -Wall -g -o obj32/linkhuge_rw.o -c linkhuge_rw.c |
| 42 | libhugetlbfs/1_2.23-r0-new/temp/log.do_compile:arm-oe-linux-gnueabi-gcc |
| 43 | -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 -Wl,-O1 |
| 44 | -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now |
| 45 | -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security |
| 46 | -Werror=format-security -Werror=return-type |
| 47 | --sysroot=/jenkins/mjansa/build/ros/oe-melodic-gatesgarth/libhugetlbfs/1_2.23-r0/recipe-sysroot |
| 48 | -B./obj32 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now |
| 49 | -ldl -L../obj32 -o obj32/linkhuge_rw -Wl,--no-as-needed -lpthread -ldl |
| 50 | -lhugetlbfs_privutils -Wl,--hugetlbfs-align obj32/linkhuge_rw.o |
| 51 | obj32/testutils.o |
| 52 | |
| 53 | And the git log between 2.22 and 2.23 is also very short and looks |
| 54 | reasonable. |
| 55 | https://github.com/libhugetlbfs/libhugetlbfs/compare/2.22...2.23 |
| 56 | |
| 57 | When checking with readelf -l it also shows the error about PHDR segment: |
| 58 | arm-oe-linux-gnueabi-readelf -l |
| 59 | ./1_2.22-r0-old/sysroot-destdir/usr/lib/libhugetlbfs/tests/obj32/linkhuge_rw |
| 60 | |
| 61 | Elf file type is DYN (Shared object file) |
| 62 | Entry point 0x201105 |
| 63 | There are 10 program headers, starting at offset 52 |
| 64 | |
| 65 | Program Headers: |
| 66 | Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align |
| 67 | PHDR 0x000034 0x00200034 0x00200034 0x00140 0x00140 R 0x4 |
| 68 | INTERP 0x000174 0x00200174 0x00200174 0x0001d 0x0001d R 0x1 |
| 69 | [Requesting program interpreter: /usr/lib/ld-linux-armhf.so.3] |
| 70 | LOAD 0x000000 0x00200000 0x00200000 0x1222c 0x1222c R E 0x200000 |
| 71 | LOAD 0x1ffdf0 0x005ffdf0 0x005ffdf0 0x102e0 0x202ec RW 0x200000 |
| 72 | DYNAMIC 0x1ffdf8 0x005ffdf8 0x005ffdf8 0x00128 0x00128 RW 0x4 |
| 73 | NOTE 0x000194 0x00200194 0x00200194 0x00044 0x00044 R 0x4 |
| 74 | GNU_EH_FRAME 0x012224 0x00212224 0x00212224 0x00008 0x00008 R 0x4 |
| 75 | GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10 |
| 76 | EXIDX 0x001c5c 0x00201c5c 0x00201c5c 0x00008 0x00008 R 0x4 |
| 77 | GNU_RELRO 0x1ffdf0 0x005ffdf0 0x005ffdf0 0x00210 0x00210 RW 0x4 |
| 78 | |
| 79 | Section to Segment mapping: |
| 80 | Segment Sections... |
| 81 | 00 |
| 82 | 01 .interp |
| 83 | 02 .interp .note.ABI-tag .note.gnu.build-id .dynsym .dynstr |
| 84 | .gnu.hash .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text |
| 85 | .fini .ARM.extab .ARM.exidx .rodata .eh_frame .eh_frame_hdr |
| 86 | 03 .fini_array .init_array .dynamic .got .data .bss |
| 87 | 04 .dynamic |
| 88 | 05 .note.ABI-tag .note.gnu.build-id |
| 89 | 06 .eh_frame_hdr |
| 90 | 07 |
| 91 | 08 .ARM.extab .ARM.exidx |
| 92 | 09 .fini_array .init_array .dynamic .got |
| 93 | |
| 94 | arm-oe-linux-gnueabi-readelf -l |
| 95 | ./1_2.23-r0-new/sysroot-destdir/usr/lib/libhugetlbfs/tests/obj32/linkhuge_rw |
| 96 | |
| 97 | Elf file type is DYN (Shared object file) |
| 98 | Entry point 0x31cd1 |
| 99 | There are 10 program headers, starting at offset 52 |
| 100 | |
| 101 | Program Headers: |
| 102 | Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align |
| 103 | PHDR 0x000000 0x00000000 0x00000000 0x00000 0x00000 R 0 |
| 104 | readelf: Error: the PHDR segment is not covered by a LOAD segment |
| 105 | INTERP 0x030d40 0x00030d40 0x00030d40 0x0001d 0x0001d R 0x1 |
| 106 | [Requesting program interpreter: /usr/lib/ld-linux-armhf.so.3] |
| 107 | LOAD 0x030d40 0x00030d40 0x00030d40 0x120b8 0x120b8 R E 0x200000 |
| 108 | LOAD 0x1ffdf0 0x003ffdf0 0x003ffdf0 0x102e0 0x202ec RW 0x200000 |
| 109 | DYNAMIC 0x1ffdf8 0x003ffdf8 0x003ffdf8 0x00128 0x00128 RW 0x4 |
| 110 | NOTE 0x030d60 0x00030d60 0x00030d60 0x00044 0x00044 R 0x4 |
| 111 | GNU_EH_FRAME 0x042df0 0x00042df0 0x00042df0 0x00008 0x00008 R 0x4 |
| 112 | GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10 |
| 113 | EXIDX 0x032828 0x00032828 0x00032828 0x00008 0x00008 R 0x4 |
| 114 | GNU_RELRO 0x1ffdf0 0x003ffdf0 0x003ffdf0 0x00210 0x00210 RW 0x4 |
| 115 | |
| 116 | Section to Segment mapping: |
| 117 | Segment Sections... |
| 118 | 00 |
| 119 | 01 .interp |
| 120 | 02 .interp .note.ABI-tag .note.gnu.build-id .dynsym .dynstr |
| 121 | .gnu.hash .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text |
| 122 | .fini .ARM.extab .ARM.exidx .rodata .eh_frame .eh_frame_hdr |
| 123 | 03 .fini_array .init_array .dynamic .got .data .bss |
| 124 | 04 .dynamic |
| 125 | 05 .note.ABI-tag .note.gnu.build-id |
| 126 | 06 .eh_frame_hdr |
| 127 | 07 |
| 128 | 08 .ARM.extab .ARM.exidx |
| 129 | 09 .fini_array .init_array .dynamic .got |
| 130 | |
| 131 | And the diff between these 2: |
| 132 | |
| 133 | 1_2.22-r0-old/sysroot-destdir/usr/lib/libhugetlbfs/tests/obj32/linkhuge_rw.readelf |
| 134 | 1_2.23-r0-new/sysroot-destdir/usr/lib/libhugetlbfs/tests/obj32/linkhuge_rw.readelf |
| 135 | Elf file type is DYN (Shared object file) |
| 136 | -Entry point 0x201105 |
| 137 | +Entry point 0x31cd1 |
| 138 | There are 10 program headers, starting at offset 52 |
| 139 | |
| 140 | Program Headers: |
| 141 | Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align |
| 142 | - PHDR 0x000034 0x00200034 0x00200034 0x00140 0x00140 R 0x4 |
| 143 | - INTERP 0x000174 0x00200174 0x00200174 0x0001d 0x0001d R 0x1 |
| 144 | + PHDR 0x000000 0x00000000 0x00000000 0x00000 0x00000 R 0 |
| 145 | +readelf: Error: the PHDR segment is not covered by a LOAD segment |
| 146 | + INTERP 0x030d40 0x00030d40 0x00030d40 0x0001d 0x0001d R 0x1 |
| 147 | [Requesting program interpreter: /usr/lib/ld-linux-armhf.so.3] |
| 148 | - LOAD 0x000000 0x00200000 0x00200000 0x1222c 0x1222c R E 0x200000 |
| 149 | - LOAD 0x1ffdf0 0x005ffdf0 0x005ffdf0 0x102e0 0x202ec RW 0x200000 |
| 150 | - DYNAMIC 0x1ffdf8 0x005ffdf8 0x005ffdf8 0x00128 0x00128 RW 0x4 |
| 151 | - NOTE 0x000194 0x00200194 0x00200194 0x00044 0x00044 R 0x4 |
| 152 | - GNU_EH_FRAME 0x012224 0x00212224 0x00212224 0x00008 0x00008 R 0x4 |
| 153 | + LOAD 0x030d40 0x00030d40 0x00030d40 0x120b8 0x120b8 R E 0x200000 |
| 154 | + LOAD 0x1ffdf0 0x003ffdf0 0x003ffdf0 0x102e0 0x202ec RW 0x200000 |
| 155 | + DYNAMIC 0x1ffdf8 0x003ffdf8 0x003ffdf8 0x00128 0x00128 RW 0x4 |
| 156 | + NOTE 0x030d60 0x00030d60 0x00030d60 0x00044 0x00044 R 0x4 |
| 157 | + GNU_EH_FRAME 0x042df0 0x00042df0 0x00042df0 0x00008 0x00008 R 0x4 |
| 158 | GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10 |
| 159 | - EXIDX 0x001c5c 0x00201c5c 0x00201c5c 0x00008 0x00008 R 0x4 |
| 160 | - GNU_RELRO 0x1ffdf0 0x005ffdf0 0x005ffdf0 0x00210 0x00210 RW 0x4 |
| 161 | + EXIDX 0x032828 0x00032828 0x00032828 0x00008 0x00008 R 0x4 |
| 162 | + GNU_RELRO 0x1ffdf0 0x003ffdf0 0x003ffdf0 0x00210 0x00210 RW 0x4 |
| 163 | |
| 164 | Section to Segment mapping: |
| 165 | |
| 166 | Revert fixes this build issue, but I still don't see why it fails this way. |
| 167 | |
| 168 | Upstream-Status: Pending |
| 169 | |
| 170 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> |
| 171 | |
| 172 | # Please enter the commit message for your changes. Lines starting |
| 173 | # with '#' will be ignored, and an empty message aborts the commit. |
| 174 | # |
| 175 | # Date: Wed Sep 16 13:43:09 2020 +0200 |
| 176 | # |
| 177 | # On branch jansa/master |
| 178 | # Changes to be committed: |
| 179 | # new file: meta-oe/recipes-benchmark/libhugetlbfs/files/0001-Revert-ld.hugetlbfs-fix-Ttext-segment-argument-on-AA.patch |
| 180 | # modified: meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb |
| 181 | # |
| 182 | # Untracked files: |
| 183 | # counts.txt |
| 184 | # diff |
| 185 | # log.svn |
| 186 | # log.svn2 |
| 187 | # wip/ |
| 188 | # |
| 189 | --- |
| 190 | ld.hugetlbfs | 4 +--- |
| 191 | 1 file changed, 1 insertion(+), 3 deletions(-) |
| 192 | |
| 193 | diff --git a/ld.hugetlbfs b/ld.hugetlbfs |
| 194 | index 5e4e497..6ee8238 100755 |
| 195 | --- a/ld.hugetlbfs |
| 196 | +++ b/ld.hugetlbfs |
| 197 | @@ -130,9 +130,7 @@ if [ "$HTLB_ALIGN" == "slice" ]; then |
| 198 | # targeting the ARM platform one needs to explicitly set the text segment offset |
| 199 | # otherwise it will be NULL. |
| 200 | case "$EMU" in |
| 201 | - armelf*_linux_eabi|aarch64elf*|aarch64linux*) |
| 202 | - printf -v TEXTADDR "%x" "$SLICE_SIZE" |
| 203 | - HTLBOPTS="$HTLBOPTS -Ttext-segment=$TEXTADDR" ;; |
| 204 | + armelf*_linux_eabi|aarch64elf*|aarch64linux*) HTLBOPTS="$HTLBOPTS -Ttext-segment=$SLICE_SIZE" ;; |
| 205 | elf_i386) HTLBOPTS="$HTLBOPTS -Ttext-segment=0x08000000" ;; |
| 206 | elf64ppc|elf64lppc) |
| 207 | if [ "$MMU_TYPE" == "Hash" ] ; then |
| 208 | -- |
| 209 | 2.17.1 |
| 210 | |