Closed Bug 1481727 Opened 6 years ago Closed 6 years ago

elfhack corner case after bug 1423822

Categories

(Firefox Build System :: General, enhancement)

enhancement
Not set
normal

Tracking

(firefox63 fixed)

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(1 file)

      No description provided.
Bug 1423822 moved the injected code section before the .text section.
When linking with lld, the text section is usually page aligned, and
starting a PT_LOAD. We inject code at the beginning of the PT_LOAD,
which means the PT_LOAD is going to be extended at least a page
downwards. And it means the preceding PT_LOAD can't finish in that same
page, so the overhead of the injected code is needs to account for the
page alignment.
Attachment #8998469 - Flags: review?(nfroyd)
Comment on attachment 8998469 [details] [diff] [review]
Fix an elfhack corner case after bug 1423822

Review of attachment 8998469 [details] [diff] [review]:
-----------------------------------------------------------------

::: build/unix/elfhack/elfhack.cpp
@@ +1085,2 @@
>      size_t align = first_executable->getSegmentByType(PT_LOAD)->getAlign();
> +    size_t new_size = relhack->getSize() + relhackcode->getSize() + relhackcode->getAddr() & (align - 1);

This is a slightly odd expression for dealing with page alignment, but I'm not sure how to make it more clearer, short of expanding the comment quite a bit.
Attachment #8998469 - Flags: review?(nfroyd) → review+
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/068870abe0cc
Fix an elfhack corner case after bug 1423822. r=froydnj
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b353e89db751
Fix up for bug 1481727, because operator priorities are fucked up in C/C++. r=bustage on a CLOSED TREE
(In reply to Pulsebot from comment #4)
> Pushed by mh@glandium.org:
> https://hg.mozilla.org/integration/mozilla-inbound/rev/b353e89db751
> Fix up for bug 1481727, because operator priorities are fucked up in C/C++.
> r=bustage on a CLOSED TREE

Because who would expect a + b & c to mean (a + b) & c?
https://hg.mozilla.org/mozilla-central/rev/068870abe0cc
https://hg.mozilla.org/mozilla-central/rev/b353e89db751
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: