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

Fix build with function sections #28

Closed
wants to merge 2 commits into from

Conversation

gretay-js
Copy link
Contributor

Fix the following build problems related to function sections:

  1. on macOs, the build fails because -function-sections compilation flag is not support by ocaml, but passed unconditionally in dune files.
  2. on linux, -ffunction-sections compilation flag is not passed to C compiler when compiling C stubs from otherlibs.

This PR is based on a patch prepared by @xclerc to address the first problem.

It creates two .sexp files based on ocaml/Makefile.config during stage1 compiler and uses them in dune files.

  • ocamlopt_flags.sexp contains OCAMLOPT_FLAGS
  • cflags.sexp contains OC_CPPFLAGS and OC_CFLAGS
    There is already a similar hack to handle flags for natdynlink.
    I don't know if there is a better way.

Flags for building C stubs are automatically supplied by dune from compiler config. These flags seem to be a subset of the ones used in Makefiles for otherlibs (and copied to cflags.sexp in this PR to be used by dune). Recent dune release provides a way to disable the defaults, but the special dune we currently use to build flambda-backend is not there yet. We should consider using it to avoid duplication of flags.

@gretay-js
Copy link
Contributor Author

I will split this into two separate PRs.

@gretay-js gretay-js closed this May 13, 2021
stedolan added a commit to stedolan/flambda-backend that referenced this pull request Jan 18, 2022
1924269795 Several fixes for partial application and currying
4fee6ae2e8 Pprintast support for new local syntax
8df43e93e5 Quieten Makefile when runtime dep files are not present
88ec84e29e Typecheck x |> f y as (f y x), not ((f y) x)
87a10e3348 Remove autogeneration of @ocaml.curry
c656dc9bb1 Merge flambda-backend changes
11b5424a69 Avoid printing double spaces in function argument lists
7751faa4f9 Restore locations to Typedtree.{pat,let}_bound_idents_full
e450b6c0e9 add build_ocaml_compiler.sexp
0403bb3eed Revert PR 9895 to continue installing VERSION
b3447dbe5d Ensure new local attributes are namespaced properly
7f213fc8b3 Allow empty functions again
8f22ad82ad Bugfix: ensure local domain state is initialised
80f54dd625 Bugfix for Selectgen with regions
e8133a189a Fix external-external signature inclusion
9840051375 Bootstrap
d879f23efd Merge remote-tracking branch 'jane/local-reviewed' into local-merge
94454f5f1c Use Local_store for the local allocations ref
54a164cf35 Create fewer regions, according to typechecking (ocaml-flambda#59)
1c2479bdb3 Merge flambda-backend changes
ce34678606 Fix printing of modes in return types
91f228128b Hook mode variable solving into Btype.snapshot/backtrack
54e4b09d64 Move Alloc_mode and Value_mode to Btype
ff4611e779 Merge flambda-backend changes
ce62e451d5 Ensure allocations are initialised, even dead ones
6b6ec5a744 Fix the alloc.ml test on 32-bit builds
81e9879ac5 Merge flambda-backend changes
40a7f89c96 Update repo URL for ocaml-jst, and rename script.
0454ee73d4 Add some new locally-allocating primitives (ocaml-flambda#57)
8acdda123d Reset the local stack pointer in exception handlers (ocaml-flambda#56)
8dafa98b49 Improve typing for (||) and (&&) (ocaml-flambda#55)
8c64754035 Fix make_check_all_arches (ocaml-flambda#54)
b50cd457aa Allow arguments to primitives to be local even in tail position (ocaml-flambda#53)
cad125dbe3 Fix modes from or-patterns (ocaml-flambda#50)
4efdb7273c Fix tailcalls tests with inlining (ocaml-flambda#52)
4a795cb4af Flambda support (ocaml-flambda#49)
74722cbf35 Add [@ocaml.principal] and [@ocaml.noprincipal] attributes, and use in oo.mli
6d7d3b87b5 Ensure that functions are evaluated after their arguments (flambda-backend ocaml-flambda#353)
89bda6b8ad Keep Sys.opaque_identity in Cmm and Mach (port upstream PR 9412)
a39126a17f Fix tailcalls within regions (ocaml-flambda#48)
4ac4cfd4b8 Fix stdlib manpages build
3a95f5edaf Merge flambda-backend changes
efe80c9b8b Add jane/pull-flambda-patches script
fca94c47c6 Register allocations for Omitted parameter closures (ocaml-flambda#47)
103b139794 Remove various FIXMEs (ocaml-flambda#46)
62ba2c1d50 Bootstrap
a0062ad6c4 Allow local allocations for various primitives (ocaml-flambda#43)
7a2165e64c Allow primitives to be poly-moded (ocaml-flambda#43)
2af3f55db6 Fix a flaky test by refactoring TypePairs (ocaml/ocaml#10638)
58dd8078aa Bootstrap
ee3be10c8f Fix modes in build_apply for partial applications
fe736568e5 Tweak for evaluation order of labelled partial applications (#10653)
052757089e Fix caml_modify on local allocations (ocaml-flambda#40)
e657e995f6 Relax modes for `as` patterns (ocaml-flambda#42)
f815bf2b4f Add special mode handling for tuples in matches and let bindings (ocaml-flambda#38)
39f1211a5f Only take the upper bounds of modes associated with allocations (ocaml-flambda#37)
aec6fde3e4 Interpret arrow types in "local positions" differently
c4f3319d19 Bootstrap
ff6fdade6e Add some missing regions
40d586de9e Bootstrap
66d8110784 Switch to a system with 3 modes for values
f2c5a85bce Bugfix for Comballoc with local allocations. (ocaml-flambda#41)
83bcd09ef1 Fix bug with root scanning during compaction (ocaml-flambda#39)
1b5ec83383 Track modes in Lambda.lfunction and onwards (ocaml-flambda#33)
f1e2e97549 Port ocaml/ocaml#10728
56703cd290 Port ocaml/ocaml#10081
eb66785575 Support local allocations in i386 and fix amd64 bug (ocaml-flambda#31)
c936b1902e Disallow local recursive non-functions (ocaml-flambda#30)
c7a193a0f3 GC support for local allocations (ocaml-flambda#29)
8dd72709c9 Nonlocal fields (ocaml-flambda#28)
e19a2f0571 Bootstrap
694b9ac5be Add syntax to the parser for local allocations (ocaml-flambda#26)
f183008978 Lower initial stack size
918226ff46 Allow local closure allocations (ocaml-flambda#27)
2552e7d257 Introduce mode variables (ocaml-flambda#25)
bc41c99b24 Minor fixes for local allocations (ocaml-flambda#24)
a2a4e608e3 Runtime and compiler support for more local allocations (ocaml-flambda#23)
d03055416b Typechecking for local allocations (ocaml-flambda#21)
9ee2332f66 Bugfix missing from ocaml-flambda#20
02c4cef20e Retain block-structured local regions until Mach.
86dbe1c7da amd64: Move stack realloc calls out-of-line
324d218997 More typing modes and locking of environments
a4080b80f9 Initial version of local allocation (unsafe)

git-subtree-dir: ocaml
git-subtree-split: 1924269795db2450be5c084f7799340e0e003e19
stedolan added a commit that referenced this pull request Feb 1, 2022
173842ce84 Merge flambda-backend changes
ed7eba2054 Remove leading space from LINE. (#484)
bd611705f7 Bump magic numbers (#5)
c50c47d1f9 Add CI builds with local allocations enabled
1412792ed7 Move local allocations support behind '-extension local'
6d8e42aeb7 Better tail call behaviour in caml_applyN
c7dac3da41 Typemod: toplevel bindings escape even if no variables are bound
82d6c3ead3 Several fixes for partial application and currying
d05c70cc93 Pprintast support for new local syntax
e0e62fcdb4 Typecheck x |> f y as (f y x), not ((f y) x)
d7e34ce7bf Remove autogeneration of @ocaml.curry
b9a05935ce Port #493
0a872d96a1 Code review fixes from #491
6c168bbc48 Remove local allocation counting
3c6e7f042c Code review fixes from #478
bb97207d1c Rename Lambda.apply_position
a7cb6509e1 Quieten Makefile when runtime dep files are not present
c656dc9bb1 Merge flambda-backend changes
11b5424a69 Avoid printing double spaces in function argument lists
7751faa4f9 Restore locations to Typedtree.{pat,let}_bound_idents_full
e450b6c0e9 add build_ocaml_compiler.sexp
0403bb3eed Revert PR 9895 to continue installing VERSION
b3447dbe5d Ensure new local attributes are namespaced properly
7f213fc8b3 Allow empty functions again
8f22ad82ad Bugfix: ensure local domain state is initialised
80f54dd625 Bugfix for Selectgen with regions
e8133a189a Fix external-external signature inclusion
9840051375 Bootstrap
d879f23efd Merge remote-tracking branch 'jane/local-reviewed' into local-merge
94454f5f1c Use Local_store for the local allocations ref
54a164cf35 Create fewer regions, according to typechecking (#59)
1c2479bdb3 Merge flambda-backend changes
ce34678606 Fix printing of modes in return types
91f228128b Hook mode variable solving into Btype.snapshot/backtrack
54e4b09d64 Move Alloc_mode and Value_mode to Btype
ff4611e779 Merge flambda-backend changes
ce62e451d5 Ensure allocations are initialised, even dead ones
6b6ec5a744 Fix the alloc.ml test on 32-bit builds
81e9879ac5 Merge flambda-backend changes
40a7f89c96 Update repo URL for ocaml-jst, and rename script.
0454ee73d4 Add some new locally-allocating primitives (#57)
8acdda123d Reset the local stack pointer in exception handlers (#56)
8dafa98b49 Improve typing for (||) and (&&) (#55)
8c64754035 Fix make_check_all_arches (#54)
b50cd457aa Allow arguments to primitives to be local even in tail position (#53)
cad125dbe3 Fix modes from or-patterns (#50)
4efdb7273c Fix tailcalls tests with inlining (#52)
4a795cb4af Flambda support (#49)
74722cbf35 Add [@ocaml.principal] and [@ocaml.noprincipal] attributes, and use in oo.mli
6d7d3b87b5 Ensure that functions are evaluated after their arguments (flambda-backend #353)
89bda6b8ad Keep Sys.opaque_identity in Cmm and Mach (port upstream PR 9412)
a39126a17f Fix tailcalls within regions (#48)
4ac4cfd4b8 Fix stdlib manpages build
3a95f5edaf Merge flambda-backend changes
efe80c9b8b Add jane/pull-flambda-patches script
fca94c47c6 Register allocations for Omitted parameter closures (#47)
103b139794 Remove various FIXMEs (#46)
62ba2c1d50 Bootstrap
a0062ad6c4 Allow local allocations for various primitives (#43)
7a2165e64c Allow primitives to be poly-moded (#43)
2af3f55db6 Fix a flaky test by refactoring TypePairs (ocaml/ocaml#10638)
58dd8078aa Bootstrap
ee3be10c8f Fix modes in build_apply for partial applications
fe736568e5 Tweak for evaluation order of labelled partial applications (#10653)
052757089e Fix caml_modify on local allocations (#40)
e657e995f6 Relax modes for `as` patterns (#42)
f815bf2b4f Add special mode handling for tuples in matches and let bindings (#38)
39f1211a5f Only take the upper bounds of modes associated with allocations (#37)
aec6fde3e4 Interpret arrow types in "local positions" differently
c4f3319d19 Bootstrap
ff6fdade6e Add some missing regions
40d586de9e Bootstrap
66d8110784 Switch to a system with 3 modes for values
f2c5a85bce Bugfix for Comballoc with local allocations. (#41)
83bcd09ef1 Fix bug with root scanning during compaction (#39)
1b5ec83383 Track modes in Lambda.lfunction and onwards (#33)
f1e2e97549 Port ocaml/ocaml#10728
56703cd290 Port ocaml/ocaml#10081
eb66785575 Support local allocations in i386 and fix amd64 bug (#31)
c936b1902e Disallow local recursive non-functions (#30)
c7a193a0f3 GC support for local allocations (#29)
8dd72709c9 Nonlocal fields (#28)
e19a2f0571 Bootstrap
694b9ac5be Add syntax to the parser for local allocations (#26)
f183008978 Lower initial stack size
918226ff46 Allow local closure allocations (#27)
2552e7d257 Introduce mode variables (#25)
bc41c99b24 Minor fixes for local allocations (#24)
a2a4e608e3 Runtime and compiler support for more local allocations (#23)
d03055416b Typechecking for local allocations (#21)
9ee2332f66 Bugfix missing from #20
02c4cef20e Retain block-structured local regions until Mach.
86dbe1c7da amd64: Move stack realloc calls out-of-line
324d218997 More typing modes and locking of environments
a4080b80f9 Initial version of local allocation (unsafe)

git-subtree-dir: ocaml
git-subtree-split: 173842ce847607a032ed3c3753ee14f22556910d
lpw25 added a commit to lpw25/flambda-backend that referenced this pull request Jul 4, 2022
0b0aefb59 Turn some partial application warnings into hints (#11338) (ocaml-flambda#30)
2caa9ee92 Add [@tail] and [@nontail] annotations on applications to control tailcalls (ocaml-flambda#31)
9fb218a0a Update `promote` target to use the `one` machinery (ocaml-flambda#28)
b5ea91231 Make empty types immediate
bc08236e9 Add failing test of an empty type being immediate
f2d439f97 Propagate escaping_context to Env locks to hint about errors (ocaml-flambda#25)
35569e181 Allow warning 68 to be controlled by attributes (ocaml-flambda#16)
28a6243af Allow type_argument to weaken return modes of expected function types (ocaml-flambda#24)
cdc728f56 Fix 'make alldepend' in otherlibs/dynlink
7807d18a0 make alldepend
2d6af2f78 Merge flambda-backend changes

git-subtree-dir: ocaml
git-subtree-split: 0b0aefb59678dd8d7a471317f3a6fa58b0f361f1
lpw25 added a commit that referenced this pull request Jul 4, 2022
0b0aefb59 Turn some partial application warnings into hints (#11338) (#30)
2caa9ee92 Add [@tail] and [@nontail] annotations on applications to control tailcalls (#31)
9fb218a0a Update `promote` target to use the `one` machinery (#28)
b5ea91231 Make empty types immediate
bc08236e9 Add failing test of an empty type being immediate
f2d439f97 Propagate escaping_context to Env locks to hint about errors (#25)
35569e181 Allow warning 68 to be controlled by attributes (#16)
28a6243af Allow type_argument to weaken return modes of expected function types (#24)
cdc728f56 Fix 'make alldepend' in otherlibs/dynlink
7807d18a0 make alldepend
2d6af2f78 Merge flambda-backend changes

git-subtree-dir: ocaml
git-subtree-split: 0b0aefb59678dd8d7a471317f3a6fa58b0f361f1
lpw25 added a commit that referenced this pull request Jul 4, 2022
0b0aefb59 Turn some partial application warnings into hints (#11338) (#30)
2caa9ee92 Add [@tail] and [@nontail] annotations on applications to control tailcalls (#31)
9fb218a0a Update `promote` target to use the `one` machinery (#28)
b5ea91231 Make empty types immediate
bc08236e9 Add failing test of an empty type being immediate
f2d439f97 Propagate escaping_context to Env locks to hint about errors (#25)
35569e181 Allow warning 68 to be controlled by attributes (#16)
28a6243af Allow type_argument to weaken return modes of expected function types (#24)
cdc728f56 Fix 'make alldepend' in otherlibs/dynlink
7807d18a0 make alldepend

git-subtree-dir: ocaml
git-subtree-split: 0b0aefb59678dd8d7a471317f3a6fa58b0f361f1
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

Successfully merging this pull request may close these issues.

None yet

2 participants