Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Instrumentation support for PIE & shared libs on x86_64 Linux #184

Closed
wants to merge 904 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
904 commits
Select commit Hold shift + click to select a range
8b26df6
[BOLT] Fix symbol table issue with ICF
maksfb Jan 8, 2020
97d893b
[BOLT] Fix issue with strict and builtin_unreachable
rafaelauler Jan 29, 2020
585d7e9
[BOLT] Fix section names under `-generate-link-sections`
maksfb Feb 7, 2020
82009ef
[BOLT] Remove BinaryContext::getFunctionData
Feb 10, 2020
1d55e52
[BOLT] Make the methods isText/isData more robust
Feb 12, 2020
91107f0
[BOLT] Decoder cache friendly alignment wrt Intel JCC Erratum
rafaelauler Feb 11, 2020
e238ed5
[BOLT] Move peepholes pass after sctc
rafaelauler Dec 3, 2019
fc9ef3b
[BOLT] Add initial bits for parsing MachO files
Jan 30, 2020
054cc54
[BOLT] Add missing std::move
Feb 18, 2020
a895e92
[BOLT] Factor out NameResolver from RewriteInstance
Feb 17, 2020
c90ca32
[BOLT] Get rid of BinarySection::IsLocal
maksfb Feb 18, 2020
cf2a7c3
[BOLT] Emit long nops by default
rafaelauler Feb 20, 2020
e941d61
[BOLT] Disassemble functions from a MachO binary
Feb 11, 2020
b1dd365
[BOLT] Add first bits to build CFG
Feb 17, 2020
bbec87e
[BOLT] Enable reversing the order of basic blocks
Feb 17, 2020
6254ec7
[BOLT][llvm] Update llvm.patch
maksfb Feb 24, 2020
901580a
[BOLT] Add missing override
Feb 24, 2020
fd86a67
[BOLT] Delete ExecutableFileMemoryManager::registerNoteSection()
maksfb Feb 24, 2020
afb91fc
[BOLT][NFC] Remove unused BinarySection member functions
maksfb Feb 25, 2020
74df78b
[BOLT][NFC] Minor refactoring of RewriteInstance
maksfb Feb 25, 2020
69d4a07
[BOLT] Fix shrink wrapping to check pops
rafaelauler Feb 19, 2020
b370404
[BOLT][NFC] Factor out relocation processing
maksfb Feb 25, 2020
2130d54
[BOLT] Fix begin decrementing
Mar 3, 2020
4f7ef1c
[BOLT][NFC] Get rid of BestFit parameter
maksfb Mar 3, 2020
e5a3bbc
[BOLT] Remove allow-section-relocations option
maksfb Mar 3, 2020
d95e0f4
[BOLT] Mark functions containing data as non-simple
Mar 3, 2020
3d777ae
[BOLT] Uniquify names of local symbols
Mar 5, 2020
21d2016
[BOLT] Refactor emission of original .eh_frame
maksfb Mar 7, 2020
131b3ea
[BOLT] Refactor ELF parts of instrumentation code
maksfb Mar 9, 2020
0a43028
[BOLT] Refactor code and data emission code
maksfb Mar 6, 2020
217e4e1
[BOLT] Refactor section prefixes
maksfb Mar 11, 2020
c3ebc73
[BOLT] Refactor ELF symbol table rewriting code
maksfb Feb 27, 2020
cb943e2
[BOLT][DWARF] Add support for base address in DWARF location lists
maksfb Mar 25, 2020
2d49671
[BOLT] Verify exceptions action table equivalence in ICF
maksfb Mar 31, 2020
5eebc01
[BOLT] Fix ICF non-determinism in non-relocation mode
maksfb Apr 5, 2020
fed3190
[BOLT] Speedup ICF by better function hashing
maksfb Apr 7, 2020
4e63eec
[BOLT] Further speedup ICF
maksfb Apr 8, 2020
36e80e4
[BOLT-X86] Fix instrumentation issue with indirect calls
rafaelauler Apr 7, 2020
2dc820a
[BOLT] Speedup RTDyld external symbol resolution
maksfb Nov 11, 2019
551b383
[BOLT] Fix .eh_frame update with ICF in non-relocation mode
maksfb Apr 16, 2020
38f2528
[BOLT] Emit ICF symbols for large functions
maksfb Apr 16, 2020
a5a8695
[BOLT] Option to control .text alignment
maksfb Apr 19, 2020
bcdac0b
[BOLT] Do not emit old .eh_frame in relocation mode
maksfb Apr 19, 2020
6a7bfb6
[BOLT] Option to fail if invalid profile detected
maksfb Apr 22, 2020
7b187aa
[BOLT] Speedup PLT processing
maksfb Apr 24, 2020
49107bf
[BOLT][NFC] Change wording while reporting functions stats
maksfb Apr 24, 2020
c050efd
[BOLT] Change symbol handling for secondary function entries
maksfb Apr 20, 2020
2062064
[BOLT][BFC] Refactor code for adding secondary function entries
maksfb Apr 27, 2020
1a1a4b2
[BOLT] Cover PIC jump table reference in non-strict mode
maksfb Apr 27, 2020
1bffc39
[BOLT] Fix dyno stats after ICF in non-reloc mode
maksfb May 2, 2020
ee96581
[BOLT] Introduce isIgnored() function attribute
maksfb May 3, 2020
1cdfe7c
[BOLT] Introduce lite processing mode without relocations
maksfb May 3, 2020
5efc754
Check runtime lib format within archiver
lxfind May 4, 2020
57b90d2
[BOLT] Ignore kernel interrupts by default
maksfb May 6, 2020
75681a0
[BOLT] Change .debug_line emission for non-simple functions
maksfb May 6, 2020
6414f6b
[BOLT] Add option to tag version
rafaelauler May 7, 2020
f27d6ae
[BOLT] Remove StringRef from IndirectCallProfile
maksfb May 15, 2020
dbd4fec
[BOLT] Refactor profile-handling code
maksfb May 8, 2020
e4359ef
Remove const call to take_front
lxfind May 21, 2020
257f558
Use shuffle instead of random_shuffle
lxfind May 21, 2020
0e5f37b
Emit functions on MachO
May 26, 2020
05dc2c6
Refactor runtime library
lxfind May 21, 2020
4d60927
Adding automatic huge page support
lxfind May 2, 2020
9679b41
[BOLT] Update section index for symbols from unemitted functions
maksfb Jun 10, 2020
ec072b0
Generate heatmap for linux kernel
takhandipu Jun 11, 2020
37135da
Provide a redundant declaration of KernelBaseAddr
Jun 15, 2020
7edb14a
Link functions on MachO
Jun 13, 2020
621bce9
Be more flexible when locating runtime libs
lxfind Jun 16, 2020
13f8b20
[BOLT] Support for lite mode with relocations
maksfb Jun 15, 2020
6db3b5c
[BOLT] Disable trapping on AVX-512 by default
maksfb Jun 18, 2020
a607aab
[BOLT] Support -hot-text in lite mode
maksfb Jun 18, 2020
e863774
[BOLT] Fix memory error
maksfb Jun 19, 2020
057ad8c
[BOLT] Properly register symbols at secondary entry points
maksfb Jun 22, 2020
4ff2e53
[BOLT] Fixes for scanExternalRefs()
maksfb Jun 22, 2020
cc431c6
[BOLT] Create entry points for internal refs from external code
maksfb Jun 22, 2020
a400646
[BOLT] Ignore functions that failed validation
maksfb Jun 22, 2020
4a972dc
[BOLT] Allow to overwrite -use-old-text option
maksfb Jun 22, 2020
c2d4446
[BOLT] Fix getNewValueForSymbol()
maksfb Jun 22, 2020
ee22a12
[BOLT] Add '-force-patch' to forcefully patch old entries
maksfb Jun 22, 2020
6aa63bf
[BOLT] Ignore duplicate relocations
maksfb Jun 23, 2020
fa8874e
[perf2bolt] Relax rules for aggregation in strict mode
maksfb Jun 25, 2020
d0885d7
[BOLT] Add static binary support
maksfb Jun 26, 2020
675a670
[BOLT] Do not emit duplicate org symbols
maksfb Jun 24, 2020
86c47a3
Update X86/pre-aggregated-perf.test
rafaelauler Jun 25, 2020
906d3cb
[TESTS] Re-add issue20/issue26 tests
rafaelauler Jul 1, 2020
67e9dab
[BOLT] Skip R_X86_64_PLT32 relocation verification
maksfb Jul 1, 2020
dc7e791
[Bolt] Improve coding style for runtime lib related code
lxfind Jul 2, 2020
461316b
Support for CDF distribution of heatmap buckets
takhandipu Jun 18, 2020
dcb5948
[BOLT] Ignore addresses from non-allocatable sections
maksfb Jul 6, 2020
54f592d
Report stale sample count and percentage
takhandipu Jul 7, 2020
e843b2d
[BOLT] Add the FeatureMiner pass to extract Calder's features.
angelica-moreira Jul 8, 2020
7a20f65
[BOLT] Fix fix-branches in presence of JRCXZ and friends
rafaelauler Jul 16, 2020
dc243bf
Revert "[BOLT] Add the FeatureMiner pass to extract Calder's features."
rafaelauler Jul 17, 2020
32a79a0
[BOLT] Allow to specify -reorder-functions option multiple times
maksfb Jul 17, 2020
bd873e5
Extracted sequence insertion function into helper function
aaupov Jul 18, 2020
28761af
Handle intra-function call in instrumentOneTarget
aaupov Jul 18, 2020
9c7c967
[BOLT] Fix hot_end symbol update with user function order
rafaelauler Jul 24, 2020
89e5998
[BOLT] Fix stack alignment for runtime lib
rafaelauler Jul 27, 2020
8f1808e
Added execution count threshold option
aaupov Jul 28, 2020
022305b
[perf2bolt] Fix for SKL bug workaround
maksfb Aug 4, 2020
3a30c75
Linux kernel marker to update special sections
takhandipu Aug 4, 2020
2cb11ff
Print when we are operating in lite mode
rafaelauler Aug 6, 2020
cf9da4c
Add first bits to support emitting more than 255 sections on MachO
Jul 22, 2020
bb96e90
[perf2bolt] Issue error when writing YAML for BOLTed input
maksfb Aug 13, 2020
e866c5f
Fix BAT cold-to-hot mappings
rafaelauler Aug 18, 2020
7ec7053
Bugfix for splitting critical edges in shrink wrapping
aaupov Aug 21, 2020
2807cde
[BOLT] Do no map sections with zero address
maksfb Sep 14, 2020
628d313
[BOLT] Eliminate "shallow" function lookup
maksfb Sep 14, 2020
43dad98
[BOLT][Linux] Initial support for special Linux Kernel sections
maksfb Sep 15, 2020
a21b696
Set InputFileOffset for MachO sections
Sep 24, 2020
8ffde2c
postProcessEntryPoints: return after setIgnored and setSimple are set
aaupov Sep 30, 2020
c6d934a
Read the entry point address on MachO
Oct 1, 2020
70a07fb
[BOLT] Fix sign issue when validating X86 relocations
rafaelauler Oct 5, 2020
5aeff9d
Add -check-overlapping-elements option
Oct 5, 2020
7da9ae5
Precompute symbol section indices on MachO
Oct 6, 2020
30dc09c
[BOLT] Refactor relocations class impl per arch, NFC
rafaelauler Oct 7, 2020
763b0e2
Add ToolPath field to MachORewriteInstance
Oct 8, 2020
33e7e2a
[BOLT] Refactor PatchEntries pass
maksfb Oct 9, 2020
86499d0
[BOLT] Disable PatchEntries in non-relocation mode on ELF
maksfb Oct 10, 2020
2f5412e
Add support for emitting code into a new segment on MachO
Oct 3, 2020
ec69f38
[BOLT] Change label name for cold fragments
maksfb Oct 12, 2020
092c4ef
Fix handling of _end symbol on MachO
Oct 12, 2020
d2592c3
[BOLT] Emit symbol size for functions
maksfb Oct 12, 2020
c75f66d
Add first bits to support emitting instrumented code on MachO
Oct 12, 2020
55f6d45
[BOLT] Fix debug line info in lite relocation mode
maksfb Oct 13, 2020
f0fd673
[BOLT] Refactor reading of debug line info
maksfb Oct 13, 2020
bee0486
[BOLT] In shrinkwrap, do not split prefix/instr
rafaelauler Oct 14, 2020
1a999c4
Add first bits to cross-compile the runtime for OSX
Oct 15, 2020
baff1b1
[BOLT][DWARF] Streamline processing of DWARF unit DIEs
maksfb Oct 16, 2020
ae27edf
Inject a hook into the entry point on MachO
Oct 15, 2020
2d8e20e
[BOLT] Ignore __hot_start, __hot_end from input
rafaelauler Oct 17, 2020
3ecb500
[BOLT] Enable lite mode by default with relocations
maksfb Oct 17, 2020
07a4929
[BOLT] Fix PatchEntries pass
maksfb Oct 21, 2020
1917c10
Add pass number to dot dump filename
aaupov Oct 22, 2020
b6985bf
[BOLT] Always keep dynamic symbols defined
maksfb Oct 22, 2020
e8f2d93
[BOLT] Fix no-asserts build
rafaelauler Oct 31, 2020
0767fc2
[DOCS] Add instrumentation instructions to README
rafaelauler Oct 30, 2020
2c6936d
[BOLT] Please sanitizers
rafaelauler Oct 30, 2020
381801e
[BOLT] Remove threaded EliminateUnreachableBlock version
rafaelauler Nov 3, 2020
0ccf942
[BOLT] Fix C++ exceptions for shared objects
maksfb Nov 4, 2020
ad45bf7
[BOLT][PR] Handle TLS relocations on AArch64
rafaelauler Nov 5, 2020
b604db8
Extract BinaryContext::registerFragment
aaupov Nov 6, 2020
ddb8042
processInterproceduralReferences: record references to cold fragments…
aaupov Nov 6, 2020
7964214
Conservatively handle jump tables in split functions
aaupov Nov 6, 2020
a14cc9c
Lost in rebase: call registerFragment with a reference to TargetBF
aaupov Nov 6, 2020
f80b812
Improve cold fragment name matching
aaupov Nov 9, 2020
2645c06
[BOLT] Disable DynoStats printing after SCTC
aaupov Nov 10, 2020
cc6c4a5
Minimize X86/shrinkwrapping-critedge test case
aaupov Nov 11, 2020
3d7d682
[BOLT] Debug logging in analyzeJumpTable
aaupov Nov 12, 2020
579ad91
[BOLT] Add invalid offset for a JT entry pointing to a fragment
aaupov Nov 12, 2020
674693e
[BOLT] Support jump tables in split fragments with entries pointing b…
aaupov Nov 12, 2020
3d4fe50
a new version of hfsort+
Nov 14, 2020
3233c22
[BOLT] Fix data race while running split functions pass
maksfb Nov 16, 2020
4a6d2fc
Link the instrumentation runtime on OSX
Nov 17, 2020
906da55
[BOLT] Handle insertion of updated CFI at the first basic block
aaupov Nov 18, 2020
59afa12
Refactor syscall wrappers for OSX
Nov 19, 2020
029fa11
Inject instrumentation's global dtor on MachO
Nov 20, 2020
22df2ee
[BOLT] Fix shrinkwrapping bug when changing frame alignment
rafaelauler Dec 4, 2020
638fff7
[TEST] Remove dependency on debug output
rafaelauler Dec 9, 2020
b6d5638
[BOLT] Add threshold options for lite mode
rafaelauler Dec 30, 2020
dee8ed6
[PERF2BOLT] Relax segment matching requirements
rafaelauler Jan 11, 2021
f8c8802
[BOLT] Fix missing newlines in debug prints
aaupov Jan 20, 2021
87ecfc4
[BOLT] Fix operator new signature
Jan 20, 2021
39ecd82
[BOLT] Enable intToStr for MacOS
Jan 21, 2021
5e5dcca
an updated version of ExtTSP
Jan 28, 2021
513c2b2
[BOLT] Add support for __literal16 section on MachO
Jan 28, 2021
9cc9a9a
[BOLT] Add support for dumping counters on MacOS
Jan 28, 2021
37a3e9f
[BOLT] Add support for dumping profile on MacOS
Jan 28, 2021
9f78889
[BOLT] Add support for reading profile on Mach-O
Jan 30, 2021
da3d28b
Rebase: Merge BOLT codebase in monorepo
aaupov Dec 2, 2020
483a138
[BOLT] Update license headers
rafaelauler Mar 16, 2021
e74c71b
Update DW_AT_stmt_list for .debug_types
ayermolo Feb 17, 2021
a470031
Fix license for a few remaining files
rafaelauler Mar 17, 2021
5a41c4a
Fix up test for Update DW_AT_stmt_list for .debug_types
ayermolo Mar 18, 2021
2c8816c
[BOLT][PR] readDynamicRelocations: Skip NONE relocations
maksfb Feb 17, 2021
c08c363
[BOLT] Ignore TBSS section at layout time
maksfb Mar 5, 2021
33c4257
[BOLT][PR] Instrumentation: Introduce -no-counters-clear and -wait-fo…
rafaelauler Mar 10, 2021
29c6955
[BOLT] Fix false references to zero-sized objects
maksfb Mar 15, 2021
0b6f594
[BOLT] Fix instrumentation bug in duplicated JTs
rafaelauler Mar 15, 2021
d38ed2b
[BOLT] Do not assert on jump table heuristic failure
maksfb Mar 23, 2021
d0e3dd4
Rebase: [cherry-pick] [BOLT] Add option to skip writing an output file
aaupov Mar 29, 2021
6c80d57
[BOLT] Refactor SectionPatchers map to a Patcher in BinarySection
aaupov Mar 18, 2021
cc724ae
[BOLT] Remove cantFail in getAddressRanges calls
rafaelauler Apr 6, 2021
1aa392b
[BOLT] Fix value invalidation bug in runtimelib
rafaelauler Apr 8, 2021
4c7c0a8
Rebase: [BOLT][NFC] Expand auto types
aaupov Apr 8, 2021
07f2713
[BOLT][NFC] Use const reference for MCInstrDesc
aaupov Apr 18, 2021
b9ae7f4
[BOLT][NFC] Remove RewriteInstance::EHFrame
maksfb Apr 21, 2021
85066d1
[BOLT] Remove -dump-eh-frame option
maksfb Apr 21, 2021
f7239af
[BOLT][NFC] Remove CFIReaderWriter::fdes()
maksfb Apr 21, 2021
5cef421
[perf2bolt] Further relax segment matching
maksfb Apr 30, 2021
69927e9
Rebase: [BOLT][NFC] Remove unneeded includes with include-what-you-use
aaupov Apr 30, 2021
8b8de18
Rebase: [BOLT][NFC] Avoid binutils in tests
aaupov May 4, 2021
6ba1f4b
[BOLT][NFC] Avoid unnecessary copies with push_back
aaupov May 8, 2021
6c817b8
[PR] Fix bb reordering optimization
Apr 23, 2021
4d22b04
[PR] Fix tests build with -no-pie option
yota9 May 11, 2021
e6d6455
[PR] Add missing includes
yota9 May 11, 2021
2309c9f
[BOLT][NFC] Follow LLVM variable initialization style
maksfb May 13, 2021
f050836
[BOLT][NFC] Address warning about ProgramPoint implicit copy constructor
aaupov May 10, 2021
67d70e2
[BOLT][NFC] Change interface for searching relocations
maksfb May 13, 2021
416f6f9
[BOLT] Preserve original jump table relocations
maksfb May 13, 2021
0041b24
[BOLT][NFC][TEST] Added llvm-dwarfdump and llvm-mc to BOLT_TEST_DEPS
aaupov May 13, 2021
3e1bbb3
Rebase: [BOLT] DebugFission Support
aaupov Apr 1, 2021
449b18e
[PR] Introduce loop inversion pass
yota9 May 11, 2021
40bfab9
[PR] Instrumentation: Emit paddings to preserve data alignment
yota9 May 14, 2021
d60be83
[BOLT][NFC] Disable ProcessAllSections in RuntimeDyld
maksfb May 26, 2021
04fbdc3
Added Github Actions workflow for building Docker image
aaupov May 14, 2021
dbd1bc4
[BOLT] Resolve JumpTable namespace issue in pseudo probe decoder migr…
luoj1 Jun 3, 2021
7d3f46d
[BOLT][TEST] Fix test case to conform to analyzePICJumpTable pattern …
aaupov Jun 2, 2021
46c5e25
[BOLT][NFC] Fix debug info printouts for inlined functions
maksfb Jun 4, 2021
f548c69
[BOLT] Hugify: check for THP support via sysfs
aaupov Jun 3, 2021
fc2ccb0
[BOLT] Change how DF DWO logging is handled
ayermolo Jun 9, 2021
35c237b
Rebase: [BOLT] Refactor the Pseudo Probe decoder
aaupov Jun 9, 2021
bcc6858
[BOLT] Add pseudo probe print out for all addesses
luoj1 Jun 11, 2021
4e95ba3
[BOLT][CSSPGO] Pseudo probe decoding
luoj1 Jun 11, 2021
cfdc2c5
[BOLT][NFC] Suppress addList override warning
aaupov Jun 3, 2021
1ee2d00
[BOLT] Fix rodata load simplification pass
maksfb Jun 13, 2021
e246afc
[PR] Instrumentation: Disable signals on mutex lock
yota9 Jun 4, 2021
f3dcfd9
[PR] Patch allocatable relocations for AArch64
yota9 Jun 1, 2021
de4d586
[BOLT][DebugFission] Fix reading support for DWP
ayermolo Jun 16, 2021
6bacb35
[PR][BOLT] Print revision in perf2bolt and bolt-diff modes"
Sameeranjoshi Jun 8, 2021
055495c
[BOLT] Fix undefined symbol warnings/errors
maksfb Jun 18, 2021
696c800
Throw an error in instrument for dynamic libs
jthamanfb Jun 21, 2021
4f7ee79
[BOLT][TESTS] Fix ICF test case
maksfb Jun 23, 2021
422a592
[BOLT] Handle R_X86_64_64 in flushPendingRelocations
aaupov Jun 24, 2021
8f2377b
[BOLT][NFC] Use MCPlusBuilder::isPseudo
aaupov Jun 16, 2021
020c535
[BOLT][CSSPGO] Relate decoded pseudo probe basic blocks
luoj1 Jun 25, 2021
83244cb
[BOLT][NFC] Readability improvements in X86,Aarch64 MCPlusBuilder
aaupov Jun 18, 2021
f6862fe
[BOLT][NFC] Refactor handlePCRelOperand
aaupov Jun 18, 2021
1b8a5bc
[BOLT][NFC] Always process runtime relocations
maksfb Jun 22, 2021
54e4581
[BOLT][NFC] Delete MoveRelocations entirely
aaupov Jun 26, 2021
6d5f37c
[BOLT][NFC] Un-inline adding external references out of disassemble loop
aaupov Jun 26, 2021
cdc1a9f
[BOLT][NFC] Un-inline indirect branch handling out of disassemble loop
aaupov Jun 26, 2021
652741d
[BOLT][NFC] Un-inline checking AArch64 linker veneers out of disassem…
aaupov Jun 26, 2021
6fe90a1
[BOLT][TESTS] Remove dynamic relocations from YAML tests
maksfb Jun 30, 2021
013ca48
[BOLT][DWARF] Fix writing out dwo with DWP as input
ayermolo Jun 18, 2021
8e1cd96
[BOLT] Read all dynamic relocations and refactor code
maksfb Jun 30, 2021
7f6bb82
[BOLT][NFC] Resolved all clang-12 warnings for bolt
jthamanfb Jun 29, 2021
403b668
[BOLT] Add support for .plt.sec and refactor PLT-reading code
maksfb Jun 30, 2021
75b24ef
Instrumentation: Generate and use _start and _fini trampolines
Jun 18, 2021
fe54f1a
Instrumentation: Add readlink and getdents support
ElvinaYakubova Jan 18, 2021
f88abfa
Instrumentation: Add support for opening libs based on links /proc/se…
ElvinaYakubova Jan 18, 2021
8a2dec2
Instrumentation: Initial support for static executables
Jun 20, 2021
20a0fb4
Instrumentation: Fix runtime handlers for PIE files
yota9 Jun 23, 2021
2c593ad
Instrumentation: refactoring IsStaticExecutable->!hasDynamicHeader
Jun 24, 2021
0cfe12b
Revert "Throw an error in instrument for dynamic libs"
Jun 25, 2021
df86d34
README: remove note about experimental status of instrumentation
Jun 24, 2021
bd15f81
Instrumentation: Introduce instrumentation-binpath argument
Jun 18, 2021
2850202
Instrumentation: Fix start and fini trampoline pointers
yota9 Jul 5, 2021
439ffb5
Tests: add instrumentation tests for PIE exec & shared libs
Jun 19, 2021
b9ce0d7
Tests: temp fix for failing tests on newer gcc versions
Jul 7, 2021
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
31 changes: 31 additions & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ubuntu:20.04 AS builder

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC

RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates git \
build-essential cmake ninja-build python3 libjemalloc-dev && \
rm -rf /var/lib/apt/lists

WORKDIR /home/bolt

COPY . llvm-bolt

WORKDIR build

RUN cmake -G Ninja ../llvm-bolt/llvm \
-DLLVM_ENABLE_PROJECTS="bolt" \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--push-state -Wl,-whole-archive -ljemalloc_pic -Wl,--pop-state -lpthread -lstdc++ -lm -ldl" \
-DCMAKE_INSTALL_PREFIX=/home/bolt/install

RUN ninja check-bolt && \
ninja install-llvm-bolt install-perf2bolt install-merge-fdata \
install-llvm-boltdiff install-bolt_rt

FROM ubuntu:20.04

COPY --from=builder /home/bolt/install /usr/local
16 changes: 16 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Docker Image CI

on:
push:
branches: [ rebased ]
pull_request:
branches: [ rebased ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build the Docker image and test
run: docker build . --file .github/workflows/Dockerfile --tag ubuntu-bolt:$(date +%s)
29 changes: 29 additions & 0 deletions bolt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
include(ExternalProject)

set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(BOLT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_CXX_STANDARD 14)

ExternalProject_Add(bolt_rt
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/runtime"
STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-stamps
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-DCMAKE_INSTALL_PREFIX=${LLVM_BINARY_DIR}
# You might want to set this to True if actively developing bolt_rt, otherwise
# cmake will not rebuild it after source code changes
BUILD_ALWAYS True
)

install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins/cmake_install.cmake \)"
COMPONENT bolt_rt)

add_llvm_install_targets(install-bolt_rt
DEPENDS bolt_rt
COMPONENT bolt_rt)

add_subdirectory(src)
add_subdirectory(test)
279 changes: 279 additions & 0 deletions bolt/LICENSE.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
==============================================================================
The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
==============================================================================

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


---- LLVM Exceptions to the Apache 2.0 License ----

As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into an Object form of such source code, you
may redistribute such embedded portions in such Object form without complying
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.

In addition, if you combine or link compiled forms of this Software with
software that is licensed under the GPLv2 ("Combined Software") and if a
court of competent jurisdiction determines that the patent provision (Section
3), the indemnity provision (Section 9) or other Section of the License
conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.

==============================================================================
Software from third parties included in the LLVM Project:
==============================================================================
The LLVM Project contains third party software which is under different license
terms. All such code will be identified clearly using at least one of two
mechanisms:
1) It will be in a separate directory tree with its own `LICENSE.txt` or
`LICENSE` file at the top containing the specific license and restrictions
which apply to that software, or
2) It will contain specific license and restriction terms at the top of every
file.

==============================================================================
Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
==============================================================================
University of Illinois/NCSA
Open Source License

Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign.
All rights reserved.

Developed by:

LLVM Team

University of Illinois at Urbana-Champaign

http://llvm.org

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.

* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.

Loading