[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#837359: ocaml: FTBFS on -fPIE binNMU on armhf - test failure



Adrian Bunk:
>  ... testing 'quicksort2':/usr/bin/ld: quicksort2.o: relocation R_ARM_THM_MOVW_ABS_NC against `cmp' can not be used when making a shared object; recompile with -fPIC
> quicksort2.o: error adding symbols: Bad value
> collect2: error: ld returned 1 exit status
>  => failed
>  ... testing 'soli':/usr/bin/ld: soli.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
> soli.o: error adding symbols: Bad value
> collect2: error: ld returned 1 exit status
>  => failed
>  ... testing 'arith':/usr/bin/ld: arith.o: relocation R_ARM_THM_MOVW_ABS_NC against `D' can not be used when making a shared object; recompile with -fPIC
> arith.o: error adding symbols: Bad value
> collect2: error: ld returned 1 exit status
>  => failed
>  ... testing 'tagged-integr':/usr/bin/ld: tagged-integr.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
> tagged-integr.o: error adding symbols: Bad value
> collect2: error: ld returned 1 exit status
>  => failed
> 
> Several other testcases are building fine.
> 
> The odd thing is that these worked on armel and arm64 but failed on armhf.
> 
> Note that the "recompile with -fPIC" error message can be misleading.
> It is also given when building binaries where only PIE is required
> (which is the default in the gcc used).
> 

It's possible OCaml itself is to blame:

asmcomp/arm/emit.mlp:
    if nh = 0l then begin
      `	movw	{emit_reg dst}, #{emit_int32 nl}\n`; 1
    end else if Int32.logand nl 0xffl = nl then begin
      `	movs	{emit_reg dst}, #{emit_int32 nl}\n`;
      `	movt	{emit_reg dst}, #{emit_int32 nh}\n`; 2
    end else begin
      `	movw	{emit_reg dst}, #{emit_int32 nl}\n`;
      `	movt	{emit_reg dst}, #{emit_int32 nh}\n`; 2
    end

Judging by http://lists.denx.de/pipermail/u-boot/2013-September/163154.html this might be invalid for ARM and PIC.

(sid_armhf-dchroot)infinity0@harris:~/ocaml/testsuite/tests/asmcomp$ rm quicksort2.s quicksort2.o

(sid_armhf-dchroot)infinity0@harris:~/ocaml/testsuite/tests/asmcomp$ make CASES=quicksort2  MLCASES= MLCASES_FLAMBDA=
make[1]: Entering directory '/home/infinity0/ocaml/testsuite/tests/asmcomp'
make[2]: Entering directory '/home/infinity0/ocaml/testsuite/tests/asmcomp'
make[2]: Nothing to be done for 'arch'.
make[2]: 'codegen' is up to date.
make[2]: Leaving directory '/home/infinity0/ocaml/testsuite/tests/asmcomp'
make[2]: Entering directory '/home/infinity0/ocaml/testsuite/tests/asmcomp'
 ... testing 'quicksort2':make[3]: Entering directory '/home/infinity0/ocaml/testsuite/tests/asmcomp'
/usr/bin/ld: quicksort2.o: relocation R_ARM_THM_MOVW_ABS_NC against `cmp' can not be used when making a shared object; recompile with -fPIC
quicksort2.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
 => failed
make[3]: Leaving directory '/home/infinity0/ocaml/testsuite/tests/asmcomp'
make[2]: Leaving directory '/home/infinity0/ocaml/testsuite/tests/asmcomp'
make[1]: Leaving directory '/home/infinity0/ocaml/testsuite/tests/asmcomp'

(sid_armhf-dchroot)infinity0@harris:~/ocaml/testsuite/tests/asmcomp$ grep -n mov[tw] quicksort2.s
138:    movw    r3, #:lower16:cmp
139:    movt    r3, #:upper16:cmp

Could someone else more familiar with ARM and/or OCaml comment please?

X

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git


Reply to: