I decided to experiment with compiling a project without the standard library. Why? I don’t know. But I could save ~50K. Just sharing my note about it.
You can find an example in my repository.
I found the -nostdlib and -nopervasives (undocumented) flags and after a lot of trying I was able to do what I wanted. It doesn’t disable absolutely everything (lists and other types like option are available).
(flags
  :standard
  -nostdlib
  -nopervasives
  ; add runtime
  -cclib
  -lasmrun
  -ccopt
  "-L %{ocaml_where}"
  -ccopt
  "-lm -ldl")
(* stdlib.ml *)
external print_endline : string -> unit = "caml_print_endline" [@@noalloc]
(* main.ml *)
open Stdlib
let () = print_endline "hello from my stdlib"
Hello World program:
| with Stdlib | without Stdlib | |
|---|---|---|
| size | 349K | 302K | 
 I don’t think we should use it.
 I don’t think we should use it.