History log of /llvm-project/bolt/lib/Core/BinaryContext.cpp (Results 1 – 25 of 125)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7
# 6e8a1a45 26-Dec-2024 Franklin <zhangfenglei@huawei.com>

[BOLT] Detect Linux kernel version if the binary is a Linux kernel (#119088)

This makes it easier to handle differences (e.g. of exception table
entry size) between versions of Linux kernel


# 4111841f 20-Dec-2024 Kristof Beyls <kristof.beyls@arm.com>

[BOLT] Correctly print preferred disassembly for annotated instructions (#120564)

This patch makes sure that `BinaryContext::printInstruction` prints the
preferred disassembly. Preferred disassembl

[BOLT] Correctly print preferred disassembly for annotated instructions (#120564)

This patch makes sure that `BinaryContext::printInstruction` prints the
preferred disassembly. Preferred disassembly only gets printed when
there are no annotations on the MCInst. Therefore, this patch
temporarily removes the annotations before printing it.

A few examples of before and after on AArch64 instructions are as
follows:

```
BEFORE AFTER
(preferred disassembly)

ret x30 ret
orr x30, xzr, x0 mov x30, x0
hint #29 autiasp
hint #12 autia1716
```

Clearly, the preferred disassembly is easier for developers to read, and
is the disassembly that tools should be printing.

This patch is motivated as part of future work on the
llvm-bolt-binary-analysis tool, making sure that the reports it prints
do use preferred disassembly.

This patch was cherry-picked from
https://github.com/kbeyls/llvm-project/tree/bolt-gadget-scanner-prototype.

In this current patch, this only affects existing RISCV test cases.

This patch also does improve test cases in future patches that will
introduce a binary analysis for llvm-bolt-binary-analysis that checks
for correct application of pac-ret (pointer authentication on return
addresses).

show more ...


Revision tags: llvmorg-19.1.6
# 2ccf7ed2 05-Dec-2024 Jared Wyles <jared.wyles@gmail.com>

[JITLink] Switch to SymbolStringPtr for Symbol names (#115796)

Use SymbolStringPtr for Symbol names in LinkGraph. This reduces string interning
on the boundary between JITLink and ORC, and allows p

[JITLink] Switch to SymbolStringPtr for Symbol names (#115796)

Use SymbolStringPtr for Symbol names in LinkGraph. This reduces string interning
on the boundary between JITLink and ORC, and allows pointer comparisons (rather
than string comparisons) between Symbol names. This should improve the
performance and readability of code that bridges between JITLink and ORC (e.g.
ObjectLinkingLayer and ObjectLinkingLayer::Plugins).

To enable use of SymbolStringPtr a std::shared_ptr<SymbolStringPool> is added to
LinkGraph and threaded through to its construction sites in LLVM and Bolt. All
LinkGraphs that are to have symbol names compared by pointer equality must point
to the same SymbolStringPool instance, which in ORC sessions should be the pool
attached to the ExecutionSession.
---------

Co-authored-by: Lang Hames <lhames@gmail.com>

show more ...


Revision tags: llvmorg-19.1.5
# 4d2bc0ad 27-Nov-2024 Enna1 <xumingjie.enna1@bytedance.com>

[BOLT] Extract comparator for sorting functions by index into helper function (#116217)

This change extracts the comparator for sorting functions by index into
a helper function `compareBinaryFunct

[BOLT] Extract comparator for sorting functions by index into helper function (#116217)

This change extracts the comparator for sorting functions by index into
a helper function `compareBinaryFunctionByIndex()`

Not sure why the comparator used in
`BinaryContext::getSortedFunctions()` is not same as the other two
places. I think they should use the same comparator, so I also change
`BinaryContext::getSortedFunctions()` to use
`compareBinaryFunctionByIndex()` for sorting functions.

show more ...


Revision tags: llvmorg-19.1.4, llvmorg-19.1.3
# c3bbc3a5 18-Oct-2024 sinan <sinan.lin@linux.alibaba.com>

[BOLT] Fix logs with no hex convension (#112650)

Add `utohexstr` to ensure that offsets/addresses are correctly formatted
as hexadecimal values.


Revision tags: llvmorg-19.1.2, llvmorg-19.1.1
# 6d216fb7 23-Sep-2024 Kristof Beyls <kristof.beyls@arm.com>

[perf2bolt] Improve heuristic to map in-process addresses to specific… (#109397)

… segments in Elf binary.

The heuristic is improved by also taking into account that only
executable segments sho

[perf2bolt] Improve heuristic to map in-process addresses to specific… (#109397)

… segments in Elf binary.

The heuristic is improved by also taking into account that only
executable segments should contain instructions.

Fixes #109384.

show more ...


Revision tags: llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3
# e49549ff 08-Aug-2024 Davide Italiano <davidino@fb.com>

Revert "[BOLT] Abort on out-of-section symbols in GOT (#100801)"

This reverts commit a4900f0d936f0e86bbd04bd9de4291e1795f1768.


# 62e894e0 07-Aug-2024 Sayhaan Siddiqui <49014204+sayhaan@users.noreply.github.com>

[BOLT][DWARF][NFC] Move Arch assignment out of createBinaryContext (#102054)

Moves the assignment of Arch out of createBinaryContext to prevent data
races when parallelized.


# a4900f0d 07-Aug-2024 Vladislav Khmelevsky <och95@yandex.ru>

[BOLT] Abort on out-of-section symbols in GOT (#100801)

This patch aborts BOLT execution if it finds out-of-section (section
end) symbol in GOT table. In order to handle such situations properly in

[BOLT] Abort on out-of-section symbols in GOT (#100801)

This patch aborts BOLT execution if it finds out-of-section (section
end) symbol in GOT table. In order to handle such situations properly in
future, we would need to have an arch-dependent way to analyze
relocations or its sequences, e.g., for ARM it would probably be ADRP +
LDR analysis in order to get GOT entry address. Currently, it is also
challenging because GOT-related relocation symbols are replaced to
__BOLT_got_zero. Anyway, it seems to be quite a rare case, which seems
to be only? related to static binaries. For the most part, it seems that
it should be handled on the linker stage, since static binary should not
have GOT table at all. LLD linker with relaxations enabled would replace
instruction addresses from GOT directly to target symbols, which
eliminates the problem.

Anyway, in order to achieve detection of such cases, this patch fixes a
few things in BOLT:
1. For the end symbols, we're now using the section provided by ELF
binary. Previously it would be tied with a wrong section found by symbol
address.
2. The end symbols would have limited registration we would only
add them in name->data GlobalSymbols map, since using address->data
BinaryDataMap map would likely be impossible due to address duality of
such symbols.
3. The outdated BD->getSection (currently returning refence, not
pointer) check in postProcessSymbolTable is replaced by getSize check in
order to allow zero-sized top-level symbols if they are located in
zero-sized sections. For the most part, such things could only be found
in tests, but I don't see a reason not to handle such cases.
4. Updated section-end-sym test and removed x86_64 requirement since
there is no reason for this (tested on aarch64 linux)

The test was provided by peterwaller-arm (thank you) in #100096 and
slightly modified by me.

show more ...


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1
# 9d2dd009 24-Jul-2024 Amir Ayupov <aaupov@fb.com>

[BOLT] Support more than two jump table parents

Multi-way splitting can cause multiple fragments to access the same jump
table. Relax the assumption that a jump table can only have up to two
parents

[BOLT] Support more than two jump table parents

Multi-way splitting can cause multiple fragments to access the same jump
table. Relax the assumption that a jump table can only have up to two
parents.

Test Plan: added bolt/test/X86/three-way-split-jt.s

Reviewers: ayermolo, dcci, rafaelauler, maksfb

Reviewed By: rafaelauler, dcci

Pull Request: https://github.com/llvm/llvm-project/pull/99988

show more ...


# 83ea7ce3 24-Jul-2024 Amir Ayupov <aaupov@fb.com>

[BOLT][NFC] Track fragment relationships using EquivalenceClasses

Three-way splitting can create references between split fragments (warm
to cold or vice versa) that are not handled by
`isChildOf/is

[BOLT][NFC] Track fragment relationships using EquivalenceClasses

Three-way splitting can create references between split fragments (warm
to cold or vice versa) that are not handled by
`isChildOf/isParentOf/isChildOrParentOf`. Generalize fragment
relationships to allow checking if two functions belong to one group,
potentially in presence of ICF which can join multiple groups.

Test Plan: NFC for existing tests

Reviewers: maksfb, ayermolo, rafaelauler, dcci

Reviewed By: rafaelauler

Pull Request: https://github.com/llvm/llvm-project/pull/99979

show more ...


Revision tags: llvmorg-20-init
# d251a328 23-Jul-2024 Jordan Brantner <81778785+brantnej@users.noreply.github.com>

[BOLT] Fix typo from alterantive to alternative (#99704)

Fix typo from `alterantive` -> `alternative`

Signed-off-by: Jordan Brantner <brantnej@oregonstate.edu>


# 86e21e1a 21-Jul-2024 Fangrui Song <i@maskray.me>

[BOLT] Remove unused bool arguments from createMCObjectStreamer callers


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6
# 3023b15f 09-May-2024 Amir Ayupov <aaupov@fb.com>

[BOLT] Support POSSIBLE_PIC_FIXED_BRANCH

Detect and support fixed PIC indirect jumps of the following form:
```
movslq En(%rip), %r1
leaq PIC_JUMP_TABLE(%rip), %r2
addq %r2, %r1
jmpq *%r1
```

w

[BOLT] Support POSSIBLE_PIC_FIXED_BRANCH

Detect and support fixed PIC indirect jumps of the following form:
```
movslq En(%rip), %r1
leaq PIC_JUMP_TABLE(%rip), %r2
addq %r2, %r1
jmpq *%r1
```

with PIC_JUMP_TABLE that looks like following:

```
JT: ----------
E1:| L1 - JT |
|----------|
E2:| L2 - JT |
|----------|
| |
......
En:| Ln - JT |
----------
```

The code could be produced by compilers, see
https://github.com/llvm/llvm-project/issues/91648.

Test Plan: updated jump-table-fixed-ref-pic.test

Reviewers: maksfb, ayermolo, dcci, rafaelauler

Reviewed By: rafaelauler

Pull Request: https://github.com/llvm/llvm-project/pull/91667

show more ...


# 4c79fac1 03-Jul-2024 Fangrui Song <i@maskray.me>

[BOLT] Remove workaround for flushPendingLabels

The code emits an empty MCDataFragment to ensure that the labels are
attached to `SplitSection`. The workaround, due to the removed
`flushPendingLabel

[BOLT] Remove workaround for flushPendingLabels

The code emits an empty MCDataFragment to ensure that the labels are
attached to `SplitSection`. The workaround, due to the removed
`flushPendingLabels` mechanism (see
75006466296ed4b0f845cbbec4bf77c21de43b40), is now unneeded.

Pull Request: https://github.com/llvm/llvm-project/pull/97632

show more ...


# 35668e2c 02-Jul-2024 Fangrui Song <i@maskray.me>

Remove llvm/MC/MCAsmLayout.h and the unused parameter in MCAssembler::layout

This restores 63ec52f867ada8d841dd872acf3d0cb62e2a99e8 and
46f7929879a59ec72dc75679b4201e2d314efba9, NFC changes that wer

Remove llvm/MC/MCAsmLayout.h and the unused parameter in MCAssembler::layout

This restores 63ec52f867ada8d841dd872acf3d0cb62e2a99e8 and
46f7929879a59ec72dc75679b4201e2d314efba9, NFC changes that were
unnecessarily reverted.

This completes the work that merges MCAsmLayout into MCAssembler.

Pull Request: https://github.com/llvm/llvm-project/pull/97449

show more ...


# ac0b48a0 02-Jul-2024 Davide Italiano <davidino@fb.com>

Revert "MCAssembler::layout: remove the unused MCAsmLayout parameter"

This reverts commit 63ec52f867ada8d841dd872acf3d0cb62e2a99e8.


# 63ec52f8 02-Jul-2024 Fangrui Song <i@maskray.me>

MCAssembler::layout: remove the unused MCAsmLayout parameter

Almost complete the MCAsmLayout removal work started by 67957a45ee1ec42ae1671cdbfa0d73127346cc95.


# dbf12b2f 01-Jul-2024 Fangrui Song <i@maskray.me>

[MC] Remove MCAsmLayout::{getSymbolOffset,getBaseSymbol}

The MCAsmLayout::* forwarders added by
67957a45ee1ec42ae1671cdbfa0d73127346cc95 have all been removed.


# c460e454 24-May-2024 Amir Ayupov <aaupov@fb.com>

[BOLT][NFCI] Fix return type of BC::getSignedValueAtAddress (#91664)


# a38f0157 23-May-2024 Amir Ayupov <aaupov@fb.com>

[BOLT] Set InitialDynoStats after EstimateEdgeCounts (#93218)

InitialDynoStats used to be assigned inside `runAllPasses`, but the
assignment executed before any of the passes. As we've moved
`Esti

[BOLT] Set InitialDynoStats after EstimateEdgeCounts (#93218)

InitialDynoStats used to be assigned inside `runAllPasses`, but the
assignment executed before any of the passes. As we've moved
`EstimateEdgeCounts` into a pass out of ProfileReader, it needs to
execute before initial dyno stats are set.

Thus move `InitialDynoStats` into BinaryContext and assignment into
`DynoStatsSetPass`.

show more ...


# c8fc234e 22-May-2024 shaw young <58664393+shawbyoung@users.noreply.github.com>

[BOLT][NFC] Eliminate uses of throwing std::map::at (#92950)

Remove calls to std::unordered_map::at, std::map::at, and
std::vector::at.


# 935b946b 22-May-2024 Amir Ayupov <aaupov@fb.com>

[BOLT] Process cross references between ignored functions in BAT mode (#92484)

To align YAML and fdata profiles produced in BAT mode, lift two
restrictions applied in non-relocation mode when BAT i

[BOLT] Process cross references between ignored functions in BAT mode (#92484)

To align YAML and fdata profiles produced in BAT mode, lift two
restrictions applied in non-relocation mode when BAT is present:
1) register secondary entry points from ignored functions,
2) treat functions with secondary entry points as simple.

This allows constructing CFG for non-simple functions in non-relocation
mode and emitting YAML profile for them, which can then be used for
optimizations in relocation mode.

Test Plan: added test ignored-interprocedural-reference.s

show more ...


Revision tags: llvmorg-18.1.5, llvmorg-18.1.4
# 603fa4c6 15-Apr-2024 Nathan Sidwell <nathan@acm.org>

[BOLT][NFC] Be more obvious about selecting X86 (#88527)

Use `isX86()` rather than `!isAArch64() && !isRISCV()`, and similar.


# 43d0891d 11-Apr-2024 Maksim Panchenko <maks@fb.com>

[BOLT] Fix handling of trailing entries in jump tables (#88444)

If a jump table has entries at the end that are a result of
__builtin_unreachable() targets, BOLT can confuse them with function
poi

[BOLT] Fix handling of trailing entries in jump tables (#88444)

If a jump table has entries at the end that are a result of
__builtin_unreachable() targets, BOLT can confuse them with function
pointers. In such case, we should exclude these targets from the table
as we risk incorrectly updating the function pointers. It is safe to
exclude them as branching on such targets is considered an undefined
behavior.

show more ...


12345