質問編集履歴

12

strace追加

2021/04/06 05:05

投稿

daiki002
daiki002

スコア68

test CHANGED
File without changes
test CHANGED
@@ -156,6 +156,238 @@
156
156
 
157
157
 
158
158
 
159
+ - straceの確認
160
+
161
+ ```
162
+
163
+ $ strace ./a.out
164
+
165
+ execve("./a.out", ["./a.out"], 0xbe816680 /* 26 vars */) = 0
166
+
167
+ brk(NULL) = 0x344000
168
+
169
+ mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f55000
170
+
171
+ access("/etc/ld.so.preload", R_OK) = 0
172
+
173
+ openat(AT_FDCWD, "/etc/ld.so.preload", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
174
+
175
+ fstat64(3, {st_mode=S_IFREG|0644, st_size=54, ...}) = 0
176
+
177
+ mmap2(NULL, 54, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0xb6f54000
178
+
179
+ close(3) = 0
180
+
181
+ readlink("/proc/self/exe", "/home/pi/a.out", 4096) = 20
182
+
183
+ openat(AT_FDCWD, "/usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
184
+
185
+ read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\254\3\0\0004\0\0\0"..., 512) = 512
186
+
187
+ _llseek(3, 16748, [16748], SEEK_SET) = 0
188
+
189
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 960) = 960
190
+
191
+ _llseek(3, 16424, [16424], SEEK_SET) = 0
192
+
193
+ read(3, "A,\0\0\0aeabi\0\1\"\0\0\0\0056\0\6\6\10\1\t\2\n\3\f\1\22\4\24"..., 45) = 45
194
+
195
+ _llseek(3, 16748, [16748], SEEK_SET) = 0
196
+
197
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 960) = 960
198
+
199
+ _llseek(3, 16424, [16424], SEEK_SET) = 0
200
+
201
+ read(3, "A,\0\0\0aeabi\0\1\"\0\0\0\0056\0\6\6\10\1\t\2\n\3\f\1\22\4\24"..., 45) = 45
202
+
203
+ _llseek(3, 16748, [16748], SEEK_SET) = 0
204
+
205
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 960) = 960
206
+
207
+ _llseek(3, 16424, [16424], SEEK_SET) = 0
208
+
209
+ read(3, "A,\0\0\0aeabi\0\1\"\0\0\0\0056\0\6\6\10\1\t\2\n\3\f\1\22\4\24"..., 45) = 45
210
+
211
+ _llseek(3, 16748, [16748], SEEK_SET) = 0
212
+
213
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 960) = 960
214
+
215
+ _llseek(3, 16424, [16424], SEEK_SET) = 0
216
+
217
+ read(3, "A,\0\0\0aeabi\0\1\"\0\0\0\0056\0\6\6\10\1\t\2\n\3\f\1\22\4\24"..., 45) = 45
218
+
219
+ _llseek(3, 16748, [16748], SEEK_SET) = 0
220
+
221
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 960) = 960
222
+
223
+ _llseek(3, 16424, [16424], SEEK_SET) = 0
224
+
225
+ read(3, "A,\0\0\0aeabi\0\1\"\0\0\0\0056\0\6\6\10\1\t\2\n\3\f\1\22\4\24"..., 45) = 45
226
+
227
+ _llseek(3, 16748, [16748], SEEK_SET) = 0
228
+
229
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 960) = 960
230
+
231
+ _llseek(3, 16424, [16424], SEEK_SET) = 0
232
+
233
+ read(3, "A,\0\0\0aeabi\0\1\"\0\0\0\0056\0\6\6\10\1\t\2\n\3\f\1\22\4\24"..., 45) = 45
234
+
235
+ fstat64(3, {st_mode=S_IFREG|0644, st_size=17708, ...}) = 0
236
+
237
+ mmap2(NULL, 81964, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6f12000
238
+
239
+ mprotect(0xb6f16000, 61440, PROT_NONE) = 0
240
+
241
+ mmap2(0xb6f25000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0xb6f25000
242
+
243
+ close(3) = 0
244
+
245
+ munmap(0xb6f54000, 54) = 0
246
+
247
+ openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
248
+
249
+ fstat64(3, {st_mode=S_IFREG|0644, st_size=80552, ...}) = 0
250
+
251
+ mmap2(NULL, 80552, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6efe000
252
+
253
+ close(3) = 0
254
+
255
+ openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libdl.so.2", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
256
+
257
+ read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0 \n\0\0004\0\0\0"..., 512) = 512
258
+
259
+ _llseek(3, 8688, [8688], SEEK_SET) = 0
260
+
261
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1080) = 1080
262
+
263
+ _llseek(3, 8340, [8340], SEEK_SET) = 0
264
+
265
+ read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
266
+
267
+ _llseek(3, 8688, [8688], SEEK_SET) = 0
268
+
269
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1080) = 1080
270
+
271
+ _llseek(3, 8340, [8340], SEEK_SET) = 0
272
+
273
+ read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
274
+
275
+ _llseek(3, 8688, [8688], SEEK_SET) = 0
276
+
277
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1080) = 1080
278
+
279
+ _llseek(3, 8340, [8340], SEEK_SET) = 0
280
+
281
+ read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
282
+
283
+ fstat64(3, {st_mode=S_IFREG|0644, st_size=9768, ...}) = 0
284
+
285
+ mmap2(NULL, 73924, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6eeb000
286
+
287
+ mprotect(0xb6eed000, 61440, PROT_NONE) = 0
288
+
289
+ mmap2(0xb6efc000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0xb6efc000
290
+
291
+ close(3) = 0
292
+
293
+ openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libc.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
294
+
295
+ read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\300x\1\0004\0\0\0"..., 512) = 512
296
+
297
+ _llseek(3, 1293204, [1293204], SEEK_SET) = 0
298
+
299
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2800) = 2800
300
+
301
+ _llseek(3, 1289788, [1289788], SEEK_SET) = 0
302
+
303
+ read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
304
+
305
+ _llseek(3, 1293204, [1293204], SEEK_SET) = 0
306
+
307
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2800) = 2800
308
+
309
+ _llseek(3, 1289788, [1289788], SEEK_SET) = 0
310
+
311
+ read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
312
+
313
+ _llseek(3, 1293204, [1293204], SEEK_SET) = 0
314
+
315
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2800) = 2800
316
+
317
+ _llseek(3, 1289788, [1289788], SEEK_SET) = 0
318
+
319
+ read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
320
+
321
+ _llseek(3, 1293204, [1293204], SEEK_SET) = 0
322
+
323
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2800) = 2800
324
+
325
+ _llseek(3, 1289788, [1289788], SEEK_SET) = 0
326
+
327
+ read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
328
+
329
+ _llseek(3, 1293204, [1293204], SEEK_SET) = 0
330
+
331
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2800) = 2800
332
+
333
+ _llseek(3, 1289788, [1289788], SEEK_SET) = 0
334
+
335
+ read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
336
+
337
+ _llseek(3, 1293204, [1293204], SEEK_SET) = 0
338
+
339
+ read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2800) = 2800
340
+
341
+ _llseek(3, 1289788, [1289788], SEEK_SET) = 0
342
+
343
+ read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
344
+
345
+ fstat64(3, {st_mode=S_IFREG|0755, st_size=1296004, ...}) = 0
346
+
347
+ mmap2(NULL, 1364764, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6d9d000
348
+
349
+ mprotect(0xb6ed5000, 65536, PROT_NONE) = 0
350
+
351
+ mmap2(0xb6ee5000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x138000) = 0xb6ee5000
352
+
353
+ mmap2(0xb6ee8000, 8988, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6ee8000
354
+
355
+ close(3) = 0
356
+
357
+ set_tls(0xb6f564d0) = 0
358
+
359
+ mprotect(0xb6ee5000, 8192, PROT_READ) = 0
360
+
361
+ mprotect(0xb6efc000, 4096, PROT_READ) = 0
362
+
363
+ mprotect(0xb6f25000, 4096, PROT_READ) = 0
364
+
365
+ mprotect(0x20000, 4096, PROT_READ) = 0
366
+
367
+ mprotect(0xb6f57000, 4096, PROT_READ) = 0
368
+
369
+ munmap(0xb6efe000, 80552) = 0
370
+
371
+ brk(NULL) = 0x344000
372
+
373
+ brk(0x365000) = 0x365000
374
+
375
+ openat(AT_FDCWD, "./libhelloworld.so", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
376
+
377
+ read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\0\0\0\0004\0\0\0"..., 512) = 512
378
+
379
+ close(3) = 0
380
+
381
+ --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
382
+
383
+ +++ killed by SIGSEGV +++
384
+
385
+ Segmentation fault
386
+
387
+ ```
388
+
389
+
390
+
159
391
  ### 補足情報(FW/ツールのバージョンなど)
160
392
 
161
393
  - OnePlus One(ARM32)(Android 9)

11

修正

2021/04/06 05:05

投稿

daiki002
daiki002

スコア68

test CHANGED
File without changes
test CHANGED
File without changes

10

修正

2021/04/06 04:53

投稿

daiki002
daiki002

スコア68

test CHANGED
File without changes
test CHANGED
@@ -160,7 +160,13 @@
160
160
 
161
161
  - OnePlus One(ARM32)(Android 9)
162
162
 
163
+ CPU: Snapdragon 801(MSM8974PRO-AC)
164
+
165
+
166
+
163
- - Raspberry Pi 4 Model B(ARM32)(Raspbian 32bit GNU/Linux 10 (buster))
167
+ - Raspberry Pi 4 Model B Rev 1.2 (ARM32)(Raspbian 32bit GNU/Linux 10 (buster))
168
+
169
+ CPU: BCM2711(Cortex-A72)
164
170
 
165
171
 
166
172
 

9

修正

2021/04/06 04:44

投稿

daiki002
daiki002

スコア68

test CHANGED
File without changes
test CHANGED
@@ -160,7 +160,7 @@
160
160
 
161
161
  - OnePlus One(ARM32)(Android 9)
162
162
 
163
- - Raspberry Pi 4 Model B(ARM32)(Raspbian GNU/Linux 10 (buster))
163
+ - Raspberry Pi 4 Model B(ARM32)(Raspbian 32bit GNU/Linux 10 (buster))
164
164
 
165
165
 
166
166
 

8

修正

2021/04/06 04:35

投稿

daiki002
daiki002

スコア68

test CHANGED
@@ -1 +1 @@
1
- AndroidOSの共有ライブラリはUbuntuで利用できないのでしょうか?
1
+ AndroidOSの共有ライブラリはLinuxで利用できないのでしょうか?
test CHANGED
File without changes

7

修正

2021/04/06 04:34

投稿

daiki002
daiki002

スコア68

test CHANGED
File without changes
test CHANGED
@@ -11,6 +11,10 @@
11
11
  AndroidもLinuxの一種のはずです。
12
12
 
13
13
  しかしなぜLinuxのRaspbian(Raspberry Pi 4)では共有ライブラリ(.soファイル)を利用するとSegmentation faultになるのでしょうか?
14
+
15
+
16
+
17
+ LinuxであればELF形式でアーキテクチャが一致していれば動作すると思っていたのですが、そもそもこの理解が間違っているのでしょうか?
14
18
 
15
19
 
16
20
 

6

修正

2021/04/06 04:34

投稿

daiki002
daiki002

スコア68

test CHANGED
File without changes
test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  AndroidもLinuxの一種のはずです。
12
12
 
13
- しかしなぜRaspberry Pi 4では共有ライブラリ(.soファイル)を利用するとSegmentation faultになるのでしょうか?
13
+ しかしなぜLinuxのRaspbian(Raspberry Pi 4)では共有ライブラリ(.soファイル)を利用するとSegmentation faultになるのでしょうか?
14
14
 
15
15
 
16
16
 

5

修正

2021/04/06 04:32

投稿

daiki002
daiki002

スコア68

test CHANGED
File without changes
test CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  ### libhelloworld.soのソースコード
32
32
 
33
- - jnk/Android.mk
33
+ - jni/Android.mk
34
34
 
35
35
  ```Makefile
36
36
 

4

修正

2021/04/06 04:32

投稿

daiki002
daiki002

スコア68

test CHANGED
File without changes
test CHANGED
@@ -94,7 +94,7 @@
94
94
 
95
95
  ```c
96
96
 
97
- // AndroidOS用はndk-buildでした。
97
+ // AndroidOS用はndk-buildでコンパイルした。
98
98
 
99
99
  // Raspberry Pi用は以下コマンドでコンパイルした。
100
100
 

3

修正

2021/04/06 04:28

投稿

daiki002
daiki002

スコア68

test CHANGED
File without changes
test CHANGED
@@ -154,7 +154,7 @@
154
154
 
155
155
  ### 補足情報(FW/ツールのバージョンなど)
156
156
 
157
- - Android OnePlus One(ARM32)
157
+ - OnePlus One(ARM32)(Android 9)
158
158
 
159
159
  - Raspberry Pi 4 Model B(ARM32)(Raspbian GNU/Linux 10 (buster))
160
160
 

2

修正

2021/04/06 04:27

投稿

daiki002
daiki002

スコア68

test CHANGED
File without changes
test CHANGED
@@ -94,7 +94,11 @@
94
94
 
95
95
  ```c
96
96
 
97
+ // AndroidOS用はndk-buildでビルドした。
98
+
99
+ // Raspberry Pi用は以下コマンドでコンパイルした。
100
+
97
- // gcc main.c -ldl^C
101
+ // gcc main.c -ldl
98
102
 
99
103
  #include <stdio.h>
100
104
 

1

修正

2021/04/06 04:25

投稿

daiki002
daiki002

スコア68

test CHANGED
File without changes
test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  AndroidもLinuxの一種のはずです。
12
12
 
13
- しかしなぜUbuntuでは共有ライブラリ(.soファイル)を利用するとSegmentation faultになるのでしょうか?
13
+ しかしなぜRaspberry Pi 4では共有ライブラリ(.soファイル)を利用するとSegmentation faultになるのでしょうか?
14
14
 
15
15
 
16
16
 
@@ -152,7 +152,7 @@
152
152
 
153
153
  - Android OnePlus One(ARM32)
154
154
 
155
- - Raspberry Pi 4 Model B(ARM32)(aspbian GNU/Linux 10 (buster))
155
+ - Raspberry Pi 4 Model B(ARM32)(Raspbian GNU/Linux 10 (buster))
156
156
 
157
157
 
158
158