Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aarch64] ocamldoc fails to link with multiple errors: relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC #6283

Closed
vicuna opened this issue Dec 30, 2013 · 5 comments

Comments

@vicuna
Copy link

vicuna commented Dec 30, 2013

Original bug ID: 6283
Reporter: Richard Jones
Status: closed (set by @xavierleroy on 2015-12-11T18:27:54Z)
Resolution: fixed
Priority: normal
Severity: major
Platform: aarch64
OS: linux
OS Version: Fedora 19
Target version: 4.02.0+dev
Fixed in version: 4.02.0+dev
Category: back end (clambda to assembly)
Tags: patch
Monitored by: "Richard Jones"

Bug description

I am try to compile OCaml (from subversion) on aarch64. Since I do not have access to real hardware, I am using qemu aarch64 emulation as described here:

http://rwmj.wordpress.com/2013/12/22/how-to-run-aarch64-binaries-on-an-x86-64-host-using-qemu-userspace-emulation/#content

plus the following patch to fix a bug in qemu:

https://lists.gnu.org/archive/html/qemu-devel/2013-12/msg04379.html

When building OCaml on Fedora 19 / aarch64 it fails to link ocamldoc:

../ocamlcompopt.sh -pp './remove_DEBUG' -I ../parsing -I ../utils -I ../typing -I ../driver -I ../bytecomp -I ../tools -I ../toplevel/ -I ../stdlib -I ../otherlibs/str -I ../otherlibs/dynlink -I ../otherlibs/unix -I ../otherlibs/num -I ../otherlibs/graph -warn-error A -c odoc.ml
../ocamlcompopt.sh -o ocamldoc.opt -linkall unix.cmxa str.cmxa dynlink.cmxa ../compilerlibs/ocamlcommon.cmxa -I ../parsing -I ../utils -I ../typing -I ../driver -I ../bytecomp -I ../tools -I ../toplevel/ -I ../stdlib -I ../otherlibs/str -I ../otherlibs/dynlink -I ../otherlibs/unix -I ../otherlibs/num -I ../otherlibs/graph -nostdlib ../tools/depend.cmx odoc_config.cmx odoc_messages.cmx odoc_global.cmx odoc_types.cmx odoc_misc.cmx odoc_text_parser.cmx odoc_text_lexer.cmx odoc_text.cmx odoc_name.cmx odoc_parameter.cmx odoc_value.cmx odoc_type.cmx odoc_exception.cmx odoc_class.cmx odoc_module.cmx odoc_print.cmx odoc_str.cmx odoc_comments_global.cmx odoc_parser.cmx odoc_lexer.cmx odoc_see_lexer.cmx odoc_env.cmx odoc_merge.cmx odoc_sig.cmx odoc_ast.cmx odoc_control.cmx odoc_inherit.cmx odoc_search.cmx odoc_scan.cmx odoc_cross.cmx odoc_comments.cmx odoc_dep.cmx odoc_analyse.cmx odoc_info.cmx odoc_dag2html.cmx odoc_to_text.cmx odoc_ocamlhtml.cmx odoc_html.cmx odoc_man.cmx odoc_latex_style.cmx odoc_latex.cmx odoc_texi.cmx odoc_dot.cmx odoc_gen.cmx odoc_args.cmx odoc.cmx
odoc_type.o: In function camlOdoc_type__entry': (.text+0xc): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol camlOdoc_type' defined in .data section in odoc_type.o
../stdlib/stdlib.a(listLabels.o): In function camlListLabels__entry': (.text+0x10): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol camlListLabels' defined in .data section in ../stdlib/stdlib.a(listLabels.o)
../stdlib/stdlib.a(listLabels.o): In function camlListLabels__entry': (.text+0x1c): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol camlListLabels' defined in .data section in ../stdlib/stdlib.a(listLabels.o)
../stdlib/stdlib.a(listLabels.o): In function camlListLabels__entry': (.text+0x28): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol camlListLabels' defined in .data section in ../stdlib/stdlib.a(listLabels.o)
../stdlib/stdlib.a(listLabels.o): In function camlListLabels__entry': (.text+0x34): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol camlListLabels' defined in .data section in ../stdlib/stdlib.a(listLabels.o)
../stdlib/stdlib.a(listLabels.o): In function camlListLabels__entry': (.text+0x40): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol camlListLabels' defined in .data section in ../stdlib/stdlib.a(listLabels.o)
../stdlib/stdlib.a(listLabels.o): In function camlListLabels__entry': (.text+0x4c): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol camlListLabels' defined in .data section in ../stdlib/stdlib.a(listLabels.o)
../stdlib/stdlib.a(listLabels.o): In function camlListLabels__entry': (.text+0x58): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol camlListLabels' defined in .data section in ../stdlib/stdlib.a(listLabels.o)
../stdlib/stdlib.a(listLabels.o): In function camlListLabels__entry': (.text+0x64): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol camlListLabels' defined in .data section in ../stdlib/stdlib.a(listLabels.o)
../stdlib/stdlib.a(listLabels.o): In function camlListLabels__entry': (.text+0x70): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol camlListLabels' defined in .data section in ../stdlib/stdlib.a(listLabels.o)
../stdlib/stdlib.a(listLabels.o): In function camlListLabels__entry': (.text+0x7c): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status File "caml_startup", line 1: Error: Error during linking make[3]: *** [ocamldoc.opt] Error 2 make[3]: Leaving directory /home/rjones/d/ocaml/ocamldoc'
make[2]: *** [ocamldoc.opt] Error 2
make[2]: Leaving directory /home/rjones/d/ocaml' make[1]: *** [opt.opt] Error 2 make[1]: Leaving directory /home/rjones/d/ocaml'
make: *** [world.opt] Error 2

Steps to reproduce

On an aarch64 platform or emulation, do:

./configure
make world.opt -j1

File attachments

@vicuna
Copy link
Author

vicuna commented Dec 30, 2013

Comment author: Richard Jones

I should note the versions of gcc, binutils that I am using are more up to date than the ones in Fedora 19. They are:

gcc-4.8.2-7.fc21.aarch64
binutils-2.24-9.fc21.aarch64

@vicuna
Copy link
Author

vicuna commented Mar 24, 2014

Comment author: Richard Jones

I believe this to be an alignment problem, not a truncation problem (the error message is certainly confusing). Making code and data aligned to 8 bytes, as in the attached patch, cures the ocamldoc problem for me. However I'm going to build a few more virt tools before I can be certain that I've fixed this.

@vicuna
Copy link
Author

vicuna commented Mar 24, 2014

Comment author: Richard Jones

It does look as if the patch fixes the problem for the virt tools as well. I have included it in Fedora Rawhide in order to get wider testing.

@vicuna
Copy link
Author

vicuna commented May 21, 2014

Comment author: @xavierleroy

I'm not quite sure what happens here (in particular data should be naturally 8-aligned already). Thanks for the testing and patch. To be applied in 4.02.

@vicuna
Copy link
Author

vicuna commented Jun 4, 2014

Comment author: @xavierleroy

Patch applied to 4.02 branch (r14950) and trunk (r14951).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant