Skip to content

ocamlopt -output-complete-obj failure on ppc64 #13692

@dra27

Description

@dra27

Given hello.ml:

Printf.printf "Hello, world of %s!\n%!" Config.architecture

and main.c:

#include <caml/callback.h>
int main(int argc, char_os **argv)
{
  caml_startup(argv);
  caml_shutdown();
  return 0;
}

compiled with:

$ ocamlopt -output-complete-obj -o ocaml.o -I +compiler-libs ocamlcommon.cmxa hello.ml
$ gcc -c -I $(ocamlopt -where) main.c

attempting to link an executable fails. trunk gives1:

$ gcc -Wl,-E -o hello -L $(ocamlopt -where) ocaml.o main.o -lcomprmarsh -lm -lpthread
ocaml.o: in function `caml_call_realloc_stack':
(.text.caml.caml_call_realloc_stack+0x1a4): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+37148
ocaml.o: in function `caml_start_program':
(.text.caml.caml_start_program+0xc): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+37140
(.text.caml.caml_start_program+0xe8): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+37170
ocaml.o: in function `caml_callback2_asm':
(.text.caml.caml_callback2_asm+0x1c): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+37130
ocaml.o: in function `caml_callback3_asm':
(.text.caml.caml_callback3_asm+0x1c): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+37138
ocaml.o: in function `caml_perform':
(.text.caml.caml_perform+0x60): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+37138
(.text.caml.caml_perform+0x9c): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+37150
ocaml.o: in function `caml_resume':
(.text.caml.caml_resume+0x58): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+37158
ocaml.o: in function `caml_runstack':
(.text.caml.caml_runstack+0x44): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+37168
ocaml.o: in function `caml_ml_array_bound_error':
(.text.caml.caml_ml_array_bound_error+0x8): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+37160
collect2: error: ld returned 1 exit status

4.14 has a similar problem:

ocaml.o: in function `caml_start_program':
(.text+0x378208): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+30960
ocaml.o: in function `caml_callback2_asm':
(.text+0x378410): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+30950
ocaml.o: in function `caml_callback3_asm':
(.text+0x378434): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+30958
collect2: error: ld returned 1 exit status

This pattern works on all the other native architectures.

Footnotes

  1. for other reasons not related to this bug, the compiler must be built without compressed marshalling (i.e. configured with --without-zstd)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions