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

32-bit configuration doesn't quite work #2

Closed
dra27 opened this issue Nov 9, 2021 · 1 comment
Closed

32-bit configuration doesn't quite work #2

dra27 opened this issue Nov 9, 2021 · 1 comment

Comments

@dra27
Copy link
Contributor

dra27 commented Nov 9, 2021

The flags for 32-bit linking need to make it to library_flags. This gets rid of the DT_TEXTREL warnings (in all except discover.exe):

diff --git a/config/discover.ml b/config/discover.ml
index 0a305bc..c41c9bf 100644
--- a/config/discover.ml
+++ b/config/discover.ml
@@ -71,12 +71,13 @@ let conf_crlibm c =
   );
   (* Workaround 32 bits linker problem.  See
      https://github.com/ocaml/opam-repository/pull/19943 *)
-  let cflags = if arch = "i386" && system = "linux_elf" then
-                 "-Wl,-z -Wl,notext" :: cflags
-               else cflags in
-  cflags
+  let libflags = if arch = "i386" && system = "linux_elf" then
+          ["-ccopt"; "-z"; "-ccopt"; "notext"]
+  else [] in
+  cflags, libflags

 let () =
   let c = C.create "crlibm" in
-  let cflags = conf_crlibm c in
-  C.Flags.write_sexp "c_flags.sexp" cflags
+  let cflags, libflags = conf_crlibm c in
+  C.Flags.write_sexp "c_flags.sexp" cflags;
+  C.Flags.write_sexp "lib_flags.sexp" libflags
diff --git a/src/dune b/src/dune
index 19addb1..e3001d5 100644
--- a/src/dune
+++ b/src/dune
@@ -22,12 +22,13 @@
          double2scs zero_scs
          multiplication_scs scs2double)
  (c_flags  :standard (:include c_flags.sexp))
+ (library_flags :standard (:include lib_flags.sexp))
  (synopsis "Binding to CRlibm, correctly rounded math lib"))

 (copy_files# crlibm/*.{c,h})
 (copy_files# crlibm/scs_lib/*.{c,h})

 (rule
- (targets log-selected.c c_flags.sexp)
+ (targets log-selected.c c_flags.sexp lib_flags.sexp)
  (deps    ../config/discover.exe)
  (action  (run %{deps})))

However, config/discover.ml selects between log.c and log-td.c - log-td.c doesn't contain the same functions which appears to be the underlying cause of the all the missing symbols in ocaml/opam-repository#19943

@Chris00
Copy link
Owner

Chris00 commented Nov 11, 2021

Thanks @dra27 for your help (and @mseri for setting up the docker testing container).

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

No branches or pull requests

2 participants