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

Optionally use orc_header to detect orc version #171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions x86_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -6397,6 +6397,11 @@ x86_64_ORC_init(void)
NULL
};
struct ORC_data *orc;
unsigned char orc_header[20];
const uint8_t orc_hash_6_4[20] = {
0xfe, 0x5d, 0x32, 0xbf, 0x58, 0x1b, 0xd6, 0x3b, 0x2c, 0xa9,
0xa5, 0xc6, 0x5b, 0xa5, 0xa6, 0x25, 0xea, 0xb3, 0xfe, 0x24,
};

if (machdep->flags & FRAMEPOINTER)
return;
Expand Down Expand Up @@ -6460,8 +6465,10 @@ x86_64_ORC_init(void)

orc->has_signal = MEMBER_EXISTS("orc_entry", "signal"); /* added at 6.3 */
orc->has_end = MEMBER_EXISTS("orc_entry", "end"); /* removed at 6.4 */

if (orc->has_signal && !orc->has_end)
if (try_get_symbol_data("orc_header", sizeof(orc_header), orc_header) &&
memcmp(orc_header, orc_hash_6_4, 20) == 0) {
Comment on lines +6468 to +6469
Copy link
Author

Choose a reason for hiding this comment

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

We might want to move these lines since we have checks on lines 6413-6421 that can fail.

machdep->flags |= ORC_6_4;
} else if (orc->has_signal && !orc->has_end)
machdep->flags |= ORC_6_4;

machdep->flags |= ORC;
Expand Down