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

Bug#256900: Ocaml compiled programs cannot be stripped



Le Wednesday 20 August 2008 17:10:06 Xavier Leroy, vous avez écrit :
> Hello Sylvain,
>
> > The solution we discussed was to find a test that can tell us what
> > binaries are "ocamlc -custom" executable. If we can find them, we can
> > warn packager that it should be rebuild without the deprecated option.
> > To detect these files we must have a very simple script, lets call it
> > "ocaml-custom-detect". The best option is that this script will be
> > written using "sh" or "perl" (maybe having an ocaml executable is
> > also be ok, we must see what is the easiest way).
> >
> > At OCaml Meeting, Xavier Leroy told me that there was a way to detect
> > it.
> >
> > Can M. Leroy provides us with more details for detection?
>
> Basically, a mixed bytecode/native executable produced by ocamlc -custom
> is characterized by being a native executable (i.e. produced by gcc)
> concatenated with a piece of OCaml bytecode, recognizable by the fact
> that it has the magic number "Caml1999X008" at the *end* of the file.
>
> (The last digit of the magic number changed during the life of OCaml,
> but it's been "8" since June 2004, and I don't expect it to change any
> time soon.  If you want to play it safe, recognize the regexp
> "Caml1999X0[0-9][0-9]".)

Sorry, but is there something I don't understand there:
17:52 toots@leonard /tmp% cat bla.ml
let () = Printf.printf "bla\n"
17:54 toots@leonard /tmp% ocamlc -o bla ./bla.ml
17:54 toots@leonard /tmp% tail -c 12 ./bla
Caml1999X008% 

Romain



Reply to: