|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
1 o, W3 n- Y# i! S7 ^
ARM-linux-gnueabi-readelf工具解决问题% @- L4 ~, d1 U7 h+ ^, B
编译一个32位平台的内核时,出现如下错误提示:
' R; I+ ^ c7 M
8 c- f/ X% w* N9 t0 C A+ u9 _* Rlibschw.a: could not read symbols: File format not recognized" u# c5 }- \+ c; m, `
@$ O( H" w1 I0 ~9 F6 e7 W- ]于是进入相应的目录发现,libschw.a这个文件是存在的,但是为啥编译不过呢,同样的编译在另外一个64位平台却没有这个报错。 Z! @: C9 ^1 J+ E Q7 [
& F$ i$ `. o( M, t; b/ v! o) F: h思路:是否与32位64位平台有关?1 B0 s2 H4 W0 g$ d
使用readelf来查看一下这个库,
% M, C6 q, A% K% s$ arm-linux-gnueabi-readelf -h modules/aw_schw/libschw1 M% N" g( H' e N- @. m
File: modules/aw_schw/libschw(aw_schw_lib.o). @* x; k! d5 z: L+ }" P9 h0 `0 e
ELF Header:- `% m& }7 u( d, E( ]8 `
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 002 v3 ?( d* b% i/ g
Class: ELF647 K" q/ ]; F0 Q ?" D7 p7 O
Data: 2's complement, little endian
8 H$ k8 u2 Q5 M }9 |. q Version: 1 (current)
$ |1 D! r2 s- E/ P6 ? OS/ABI: UNIX - System V2 B c0 v7 g* y; l
ABI Version: 0
; t1 M# I5 v! q3 s Type: REL (Relocatable file)
# a" h9 [0 J) ? Machine: <unknown>: 0xb7: `! H. f6 v- ^& {
Version: 0x19 Z2 b) E+ \1 H @* u; H! u
Entry point address: 0x05 y# T. `5 ^ b7 U: m
Start of program headers: 0 (bytes into file)) d/ \( `+ y% N
Start of section headers: 161192 (bytes into file): Z+ T6 A* ]0 B3 s- K$ B
Flags: 0x0
( o, o$ K. q6 ~3 R Size of this header: 64 (bytes)& x9 s& u6 ^" F9 H/ O. E8 |" d: L
Size of program headers: 0 (bytes)- o6 \1 P, Z* W- m9 w5 w
Number of program headers: 0: D! k! o! A) [
Size of section headers: 64 (bytes)
: G1 p: g/ s& k: d Number of section headers: 29) O* V1 J1 [) A- e
Section header string table index: 24
0 D( d+ Q6 F1 B Y/ a% r果然,这个库显示是64位的,为了兼容32位的,只能修改Makefile,判断到32位时,使用32位的库。
2 Q$ @4 K. \7 ^. c- V; m; `+ifeq ($(LICHEE_ARCH),arm64), T! M7 W" j! ^1 S. `$ A
cp libschw libschw.a
. O2 e; l8 e2 P# i0 O3 }. d+ C& h+else" x8 B! E6 l2 ?: Z2 R5 T
+ cp libschw32 libschw.a
! S* S( {6 J7 m* c3 U+endif) ~& Z. u& |. n& ]# k
重新弄一份新32位的libschw32库后,重新编译,问题解决。
+ X- x' |$ U9 H, k |
|