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

Named text sections for caml_system__code_begin/end symbols #9631

Merged
merged 2 commits into from
Oct 22, 2020

Conversation

gretay-js
Copy link
Contributor

Place the symbols caml_system__code_begin and caml_system__code_end into their own named text sections .text.caml.caml_system__code_begin and .text.caml.caml_system__code_end, respectively, when function sections are enabled. Other symbols that mark begin and end of code segments are already placed their own named text sections.

Note that this PR changes the section names for caml_hot__code_begin and caml_hot__code_begin symbols: they are prefixed with .text.caml instead of .text only. The new names are consistent with the section names for other code segment markers. Linker scripts that use caml_hot__* symbols will need to be adjusted, but it's probably only used by ocamlfdo.

With these changes, the symbols appear in the correct order in the executable:

caml_hot__code_begin
caml_hot__code_end
caml_system__code_begin
caml_call_gc
...

instead of

caml_system__code_begin
caml_hot__code_begin
caml_hot__code_end
caml_call_gc
...

when linked with default linkers on Linux systems.
It makes debuggers happy again, as originally intended here:

ocaml/runtime/amd64.S

Lines 308 to 310 in ca64723

G(caml_system__code_begin):
ret /* just one instruction, so that debuggers don't display
caml_system__code_begin instead of caml_call_gc */
)

gretay-js added a commit to gretay-js/ocaml that referenced this pull request Jun 25, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 16, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 20, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 20, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 21, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 21, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 30, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jul 30, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
hhugo pushed a commit to janestreet/ocaml that referenced this pull request Jul 31, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 3, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 4, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 5, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 7, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 10, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 10, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
hhugo pushed a commit to janestreet/ocaml that referenced this pull request Aug 13, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
hhugo pushed a commit to janestreet/ocaml that referenced this pull request Aug 13, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 17, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 18, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 19, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 20, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Aug 28, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Sep 2, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Sep 2, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Sep 2, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Sep 7, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
hhugo pushed a commit to janestreet/ocaml that referenced this pull request Sep 8, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to janestreet/ocaml that referenced this pull request Sep 29, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to janestreet/ocaml that referenced this pull request Sep 30, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to janestreet/ocaml that referenced this pull request Sep 30, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to janestreet/ocaml that referenced this pull request Oct 1, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
mshinwell pushed a commit to janestreet/ocaml that referenced this pull request Oct 1, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
hhugo pushed a commit to janestreet/ocaml that referenced this pull request Oct 5, 2020
…-pick

388524f)

Add named text sections for caml_system__code_begin/end symbols
@gretay-js gretay-js force-pushed the named_sections_for_caml_system_code branch from 388524f to 2955400 Compare October 14, 2020 09:20
Copy link
Contributor

@let-def let-def left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the patch is correct. Though I am not familiar with other platforms (I was not even aware of \name syntax on ARM64).

@gretay-js
Copy link
Contributor Author

Thank you @let-def for your review. Does this PR need a Changes entry?

@Octachron Octachron added this to the 4.12 milestone Oct 19, 2020
@gretay-js gretay-js force-pushed the named_sections_for_caml_system_code branch from c4da8d3 to 1e91d2b Compare October 19, 2020 15:48
@lpw25 lpw25 merged commit 055f04d into ocaml:trunk Oct 22, 2020
@gasche
Copy link
Member

gasche commented Oct 22, 2020

(Note for @lpw25: we also expect a backport in 4.12.)

lpw25 added a commit that referenced this pull request Oct 22, 2020
…m_code

Named text sections for caml_system__code_begin/end symbols
@lpw25
Copy link
Contributor

lpw25 commented Oct 22, 2020

Cherry-picked to 4.12 as 0046bcb

gretay-js added a commit to gretay-js/ocaml that referenced this pull request May 28, 2021
…-pick 388524f)

Add named text sections for caml_system__code_begin/end symbols
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.

5 participants