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