softfp 로 빌드된 라이브러리를 hardfp 에서 돌릴수 있냐? 라는 것으로 검색중..
아무튼 ld-linux-armhf.so.3 가 있는 시스템에서 ld-linux.so.3를 요청하는 것을 보면
hf(hard float)가 아니라 soft float 시스템용 라이브러리로 빌드 된 것으로 보이는데
ld-linux.so.3를 검색한 결과로는 ln을 통해 ld-linux-armhf.so.3를 ld-linux.so.3로 심볼릭 링크하라는 말들이 나온다.
[링크 : https://forum.lazarus.freepascal.org/index.php?topic=15108.0]
[링크 : https://unix.stackexchange.com/questions/553743/correct-way-to-add-lib-ld-linux-so-3-in-debian]
아래는 ld-linux-armhf.so가 된 이유?
[링크 : https://lists.linaro.org/pipermail/cross-distro/2012-April/000261.html]
빌드 시에는 아래와 같이 에러가 난다고 하는데
ln -s 로 해주면 일단은 우회는 되지만
warning: ld-linux.so.3, needed by libidontknow.so, not found (try using -rpath or -rpath-link)
정작 실행했을 경우 해결이 되지 않고 특정 라이브러리를 불러오는데 에러가 발생을 했다고만 간략하게 나온다.
./sample: error while loading shared libraries: libidontknow.so: internal error
무슨 문제가 있나 곰곰히 고민을 해보니 softfp와 hardfp의 차이인것 같아서 검색해보니
ABI가 달라서 두개를 혼용할 수 없는게 문제인 것으로 보이는데
그렇게 따지면.. ld-linux.so.3를 찾아서 넣는게 오히려 빠른 해결 책이 아닐까 생각이 된다.
좀 더 근원적으로는, 사용하려는 libidontknow.so를 softfp가 아닌 hardfp로 빌드하는게 가장 좋긴 하겠지만 말이다.
+
호출 규약이 다르다..
| soft : floating-point 연산을 위한 라이브러리 콜을 포함하도록 gcc 가 컴파일 결과를 만들어낸다. softfp : hardware floating-point instruction 을 생성하도록 하지만, 여전히 soft-float 호출 규약(calling convention)을 사용한다. hard : floating-point instructions 을 생성하고 FPU 특화된 호출 규약(calling convention)을 사용한다. |
[링크 : https://pinocc.tistory.com/127]
ABI 컨벤션이 다르다..
| Applications, which are built under “hardfp” option, cannot work under Linux, that was compiled under “softfp” – because different ABI conventions; function parameters transfer are different : the soft float conventions assume passing floats through general purpose (integer) registers, but “hardfp” uses the floating point register. |
[링크 : https://community.nxp.com/t5/i-MX-Processors/imx6q-hard-float-or-soft-float/m-p/209848]
armhf는 이름대로 hard-float용이고 없는 녀석은 soft-float 용.
arm
hard-float ABI, BE32: /lib/ld-linux-armhf.so.3
hard-float ABI, BE8: /lib/ld-linux-armhf.so.3
hard-float ABI, LE: /lib/ld-linux-armhf.so.3
soft-float ABI, BE32: /lib/ld-linux.so.3
soft-float ABI, BE8: /lib/ld-linux.so.3
soft-float ABI, LE: /lib/ld-linux.so.3
(The ARM soft-float ABI can be used with both hard and soft-float code. ARM supports two variants of big-endian operation, (on newer processors) BE8 and (on older processors) BE32, which are the same at .o level but incompatible for linked executables and shared libraries.)
[링크 : https://sourceware.org/glibc/wiki/ABIList]
+
[링크 : https://talkingaboutme.tistory.com/entry/Linux-floating-point-관련-삽질중]
+
아래와 같은 항목이 보이는 걸 봐서는 mfloat-abi는 softfp 방식으로 abi를 선언할 뿐
실제 연산은 mfpu로 선언된 neon을 통해서 구현이 되도록 설정이 가능한 것으로 보인다.
| export CC="arm-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon --sysroot=/home/eric/src/imx6/opt/ESX/imx6/sysroots/armv7a-vfp-neon-linux-gnueabi" |
[링크 : https://gist.github.com/ericbutters/6049429b834edfaa0d2d]
그러니까 soft는 순수하게 software float point 계산
hard는 hardware float point 계산
softfp는 hardware float point 를 사용하지만 함수 호출 방식은 soft 방식을 쓴다고 보면 될 듯?
| -mfloat-abi=name Specifies which floating-point ABI to use. Permissible values are: ‘soft’, ‘softfp’ and ‘hard’. Specifying ‘soft’ causes GCC to generate output containing library calls for floating-point operations. ‘softfp’ allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions. ‘hard’ allows generation of floating-point instructions and uses FPU-specific calling conventions. The default depends on the specific target configuration. Note that the hard-float and soft-float ABIs are not link-compatible; you must compile your entire program with the same ABI, and link with a compatible set of libraries. |
[링크 : https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html]
+
예전에 한참 고생하게 만들었던 gcc multilib이 이럴때 언급될줄이야..
아무튼 컴파일러가 multilib을 지원하면 softfp를 쓰라는데 반대로 multilib을 지원하지 않으면 soft, hard만 지원한다는 건가?
| If the compiler has multilib enabled (you can tell with -print-multi-lib) then you can use -mfloat-abi=softfp, but if not then that option won't help you much: gcc will happily generate softfp code, but then there'll be no compatible libgcc to link against. |
[링크 : https://stackoverflow.com/questions/9753749/]
[링크 : https://stackoverflow.com/questions/48224372/]
+

[링크 : https://www.gurucoding.com/rpi_cross_compiler/2012/04_diff_hardfp_softfp/]
'embeded > ARM' 카테고리의 다른 글
| vfp (0) | 2021.01.13 |
|---|---|
| NEON 강제활성화? (0) | 2021.01.12 |
| ampere altra (0) | 2020.11.23 |
| arm cl (0) | 2020.10.29 |
| arm64 server sysbench (0) | 2020.09.23 |