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

Backport main changes to the hiperf branch and LLD fix #165

Merged
merged 12 commits into from
Apr 24, 2023

Conversation

erenon
Copy link
Contributor

@erenon erenon commented Apr 14, 2023

This should also fix the CI.

erenon and others added 11 commits April 14, 2023 10:48
Previously has_tag reported true, even if the specified template
had members (depending on the template arguments) that did not have
a tag.
Use Clang, because GitHub Ubuntu latest image has gcc 9,
that does not support concepts. clang 10 should have a better support.

 - https://gcc.gnu.org/projects/cxx-status.html
 - https://clang.llvm.org/cxx_status.html
Use cmake options (defaulting to on) for the bread and brecovery binaries,
as well as the tests and examples. This aids installation of binlog through
vcpkg.
Newly disabled checks:

    bugprone-easily-swappable-parameters
    google-readability-casting
    modernize-use-default-member-init
    readability-identifier-length

The diff is bigger, as the checklist is now sorted.
@erenon erenon changed the title Backport main changes to the hiperf branch Backport main changes to the hiperf branch and LLD fix Apr 20, 2023
In our custom ELF section, .binlog.esrc, we are storing
8 pointers/EventSource, see create_source.hpp.

Previously, we listed the loaded files,
and extracted these pointers from the on-disk files
where the program was loaded from.

GNU ld and gold sets these pointers build time
to offsets in the file, that are relocated load time.
lld, however, leaves them blank, a different kind
of relocation is used instead.

Therefore, we have to get the sources from memory, instead of disk.
We are using dl_iterate_phdr to get the list of loaded
objects + their load address. The program headers
reference segments, a set of mapped sections.
Unfortunately, I wasn't able to find the
section headers in memory (probably it isn't there),
so we still need to read the original file, find our custom
section, and map it to a loaded segment.

Since we are reading the pointers from loaded memory,
our section must be "allocated". Since it contains relocations,
it must be marked as writable, otherwise the linker warns:
"relocation in read-only section `.binlog.esrc'".
Therefore, we add "wa" to the .pushsection directive.

A range-check bug in the original implementation was found
and fixed by Eric Harding, that triggered the investigation
that ended with this fix - thanks!
@erenon
Copy link
Contributor Author

erenon commented Apr 20, 2023

@spektrof PTAL and merge, thanks!

@spektrof spektrof merged commit dd0424d into morganstanley:hiperf Apr 24, 2023
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.

2 participants