-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[BOLT] Add --pad-funcs-before=func:n #117924
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Test checks that --pad-before-funcs is working as expected. | ||
# It should be able to introduce a configurable offset for the _start symbol. | ||
# It should reject requests which don't obey the code alignment requirement. | ||
|
||
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o | ||
peterwaller-arm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -Wl,--section-start=.text=0x4000 | ||
# RUN: llvm-bolt %t.exe -o %t.bolt.0 --pad-funcs-before=_start:0 | ||
# RUN: llvm-bolt %t.exe -o %t.bolt.4 --pad-funcs-before=_start:4 | ||
# RUN: llvm-bolt %t.exe -o %t.bolt.8 --pad-funcs-before=_start:8 | ||
|
||
# RUN: not llvm-bolt %t.exe -o %t.bolt.8 --pad-funcs-before=_start:1 2>&1 | FileCheck --check-prefix=CHECK-BAD-ALIGN %s | ||
|
||
# CHECK-BAD-ALIGN: user-requested 1 padding bytes before function _start(*2) is not a multiple of the minimum function alignment (4). | ||
|
||
# RUN: llvm-objdump --section=.text --disassemble %t.bolt.0 | FileCheck --check-prefix=CHECK-0 %s | ||
# RUN: llvm-objdump --section=.text --disassemble %t.bolt.4 | FileCheck --check-prefix=CHECK-4 %s | ||
# RUN: llvm-objdump --section=.text --disassemble %t.bolt.8 | FileCheck --check-prefix=CHECK-8 %s | ||
|
||
# Trigger relocation mode in bolt. | ||
.reloc 0, R_AARCH64_NONE | ||
|
||
.section .text | ||
.globl _start | ||
|
||
# CHECK-0: 0000000000400000 <_start> | ||
# CHECK-4: 0000000000400004 <_start> | ||
# CHECK-8: 0000000000400008 <_start> | ||
_start: | ||
ret |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an issue here with the static map.
If either
opts::FunctionPadSpec
oropts::FunctionPadBeforeSpec
are set, the map is going to be populated with the respective spec in the first invocation ofBinaryEmitter::emitFunction
. The subsequent invocations will pick up the padding from the map irrespective of whetheropts::FunctionPadSpec
oropts::FunctionPadBeforeSpec
is passed as a parameter.This breaks one of our internal tests so I'm going to revert this patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting and the revert. Fix is at #121918.