|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
/ X/ x' e, F% P0 rARM-linux-gnueabi-readelf工具解决问题
B1 ^0 `2 D E+ D) n编译一个32位平台的内核时,出现如下错误提示:' j( j1 c6 O/ ?6 I
" a6 A' A1 I1 M* o* Z1 s1 G
libschw.a: could not read symbols: File format not recognized
, L3 y/ y7 e( Z2 E* o# Y/ A: f/ b" K# P- u6 {/ K
于是进入相应的目录发现,libschw.a这个文件是存在的,但是为啥编译不过呢,同样的编译在另外一个64位平台却没有这个报错。
, L. m, L1 d' h7 w1 m: O g z9 J0 l( _: P9 B- A; v; I8 ]
思路:是否与32位64位平台有关?
2 S* V M _" n+ o! C" p使用readelf来查看一下这个库,, \4 T: M+ N8 _/ H
$ arm-linux-gnueabi-readelf -h modules/aw_schw/libschw
J: P8 E1 D+ Z8 N' f* EFile: modules/aw_schw/libschw(aw_schw_lib.o)
1 M! s, B' n6 S$ |. X! @" GELF Header:
8 e' ] ^9 I3 D/ n9 q% Q Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
; W! a f6 W. t# m5 z4 I Class: ELF64 s5 H! M2 A4 W9 s
Data: 2's complement, little endian
" a# {2 X2 {$ F5 J6 ~ Version: 1 (current)9 x: n# z& x, d
OS/ABI: UNIX - System V* S- F4 X o) f6 w! W: I5 ~! l
ABI Version: 0+ w4 D+ R# {' s1 ^# n! Z
Type: REL (Relocatable file)0 K. F# u- \ M* W
Machine: <unknown>: 0xb7+ t5 T5 B$ i- y; C5 L% b5 }! S
Version: 0x1, b: \4 V* ]9 l f8 Z! @7 X
Entry point address: 0x0) A. v- i7 s: a3 t5 f. j
Start of program headers: 0 (bytes into file)
, c" m o/ a. o8 l) M& ] Start of section headers: 161192 (bytes into file)1 N& R3 w& C( B1 k
Flags: 0x0% h! K* i8 y4 a
Size of this header: 64 (bytes): ]& |9 K5 X' L x# r; x, N6 U
Size of program headers: 0 (bytes)
$ x8 Q/ N: l+ e+ n1 B# d Number of program headers: 01 Q/ E6 E; o3 `. U1 t
Size of section headers: 64 (bytes)
1 H; x* R* L; ~+ \ Number of section headers: 29
E |( g( D! _0 |- B, Q9 o3 N& z Section header string table index: 24
5 @1 ~9 j+ h# Q$ d果然,这个库显示是64位的,为了兼容32位的,只能修改Makefile,判断到32位时,使用32位的库。
7 [* e" }! C& l8 A& b+ifeq ($(LICHEE_ARCH),arm64)
9 L& S! p* u% M. k0 X cp libschw libschw.a
& [" s8 `1 b2 L' @# _( _ ^( L4 ]$ i+else7 P, z& b. L5 S+ L! i
+ cp libschw32 libschw.a
& E* }' y. E: `+ e+endif A0 h) I) U$ _) e4 m
重新弄一份新32位的libschw32库后,重新编译,问题解决。* H# ?2 F8 Z3 k2 K, P
|
|