<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/85567>85567</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLVM-BOLT and glibc on x86_64
</td>
</tr>
<tr>
<th>Labels</th>
<td>
BOLT
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
romanovj
</td>
</tr>
</table>
<pre>
First error: no DT_FINI || DT_FINI_ARRAY.
Fixed with
```
static void fini(void) {}
__attribute__((section(".fini_array"), used)) static typeof(fini) *fini_p = fini;
```
Second error: can't disassemble function ____longjmp_chk (asm code of this function in sysdeps/x86_64/__longjmp.S)
Fixed by replcaing asm code with nop =)
Third error: BOLT-ERROR: Offset overflow for dynamic relocation
```
BOLT-INFO: shared object or position-independent executable detected
BOLT-INFO: Target architecture: x86_64
BOLT-INFO: BOLT version: 8c3b2f419a0eb5d5b4702568beee561b740e0b08
BOLT-INFO: first alloc address is 0x0
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
BOLT-INFO: enabling relocation mode
BOLT-INFO: enabling lite mode
BOLT-ERROR: function __restore_rt/1 is in conflict with FDE [398ff, 39909). Skipping.
BOLT-WARNING: sizes differ for function __setcontext/1. FDE : 125; symbol table : 145. Using max size.
BOLT-WARNING: sizes differ for function setcontext. FDE : 125; symbol table : 145. Using max size.
BOLT-WARNING: sizes differ for function __GI___clone/1. FDE : 48; symbol table : 91. Using max size.
BOLT-WARNING: sizes differ for function clone. FDE : 48; symbol table : 91. Using max size.
BOLT-WARNING: sizes differ for function __clone. FDE : 48; symbol table : 91. Using max size.
BOLT-WARNING: sizes differ for function __clone3/1. FDE : 23; symbol table : 67. Using max size.
BOLT-WARNING: sizes differ for function clone3/1. FDE : 23; symbol table : 67. Using max size.
BOLT-WARNING: sizes differ for function __GI___clone3/1. FDE : 23; symbol table : 67. Using max size.
BOLT-WARNING: FDE [0x3df4d, 0x3df61) conflicts with function __setcontext/1(*2)
BOLT-WARNING: FDE [0xfcc1a, 0xfcc2a) conflicts with function __GI___clone/1(*3)
BOLT-WARNING: FDE [0xfcc2a, 0xfcc3b) conflicts with function __GI___clone/1(*3)
BOLT-WARNING: FDE [0xfcd81, 0xfcd92) conflicts with function __clone3/1(*3)
BOLT-WARNING: FDE [0xfcd92, 0xfcda3) conflicts with function __clone3/1(*3)
BOLT-ERROR: symbol seen in the middle of the function __BOLT_FDE_FUNCat398ff. Skipping.
BOLT-INFO: pre-processing profile using branch profile reader
BOLT-INFO: forcing -jump-tables=move as PIC jump table was detected in function __printf_buffer_flush/1
BOLT-INFO: 321 out of 3749 functions in the binary (8.6%) have non-empty execution profile
BOLT-INFO: 10 functions with profile could not be optimized
BOLT-WARNING: 270 (84.1% of all profiled) functions have invalid (possibly stale) profile. Use -report-stale to see the list.
BOLT-WARNING: 1108082 out of 1109415 samples in the binary (99.9%) belong to functions with invalid (possibly stale) profile.
BOLT-INFO: profile for 1 objects was ignored
BOLT-INFO: the input contains 60 (dynamic count : 0) opportunities for macro-fusion optimization. Will fix instances on a hot path.
BOLT-INFO: 4846 instructions were shortened
BOLT-INFO: removed 1226 empty blocks
BOLT-INFO: removed 1 'repz' prefixes with estimated execution count of 0 times.
BOLT-INFO: basic block reordering modified layout of 13 functions (4.05% of profiled, 0.35% of total)
BOLT-INFO: UCE removed 1 blocks and 1 bytes of code
BOLT-INFO: splitting separates 3231 hot bytes from 11944 cold bytes (21.29% of split functions is hot).
BOLT-INFO: 1 Functions were reordered by LoopInversionPass
BOLT-INFO: hfsort+ reduced the number of chains from 330 to 306
BOLT-INFO: program-wide dynostats after all optimizations before SCTC and FOP:
325 : executed forward branches
34 : taken forward branches
197 : executed backward branches
133 : taken backward branches
20 : executed unconditional branches
43301 : all function calls
16 : indirect calls
0 : PLT calls
177808 : executed instructions
1931 : executed load instructions
985 : executed store instructions
0 : taken jump table branches
0 : taken unknown indirect branches
542 : total branches
187 : taken branches
355 : non-taken conditional branches
167 : taken conditional branches
522 : all conditional branches
374 : executed forward branches (+15.1%)
5 : taken forward branches (-85.3%)
148 : executed backward branches (-24.9%)
99 : taken backward branches (-25.6%)
25 : executed unconditional branches (+25.0%)
43301 : all function calls (=)
16 : indirect calls (=)
0 : PLT calls (=)
177820 : executed instructions (+0.0%)
1931 : executed load instructions (=)
985 : executed store instructions (=)
0 : taken jump table branches (=)
0 : taken unknown indirect branches (=)
547 : total branches (+0.9%)
129 : taken branches (-31.0%)
418 : non-taken conditional branches (+17.7%)
104 : taken conditional branches (-37.7%)
522 : all conditional branches (=)
BOLT-INFO: SCTC: patched 8 tail calls (8 forward) tail calls (0 backward) from a total of 8 while removing 0 double jumps and removing 8 basic blocks totalling 40 bytes of code. CTCs total execution count is 0 and the number of times CTCs are taken is 0
BOLT-WARNING: failed to patch entries in __memmove_sse2_unaligned_erms/1(*2). The function will not be optimized.
BOLT-INFO: padding code to 0x400000 to accommodate hot text
BOLT-INFO: setting __hot_start to 0x200000
BOLT-INFO: setting __hot_end to 0x22d38c
BOLT-INFO: patched build-id (flipped last bit)
BOLT-ERROR: Offset overflow for dynamic relocation
```
I don't know how to fix it. Here is libc.so.6 and fdata.
[libc.gz](https://github.com/llvm/llvm-project/files/14627498/libc.gz)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8WVuPnLgS_jXMS6kRGGjgYR7mkt4zUk4SJbNndZ6QwUW3M8ZGtplLfv2RDX2b0D0T7Z6MVpsG6ubPVeWvgBrD1xLxMsiug-z2gg52o_SlVh2V6vH7Ra3Yy-WKa2MBtVY6SK5AKri9r1Z3n-4gyG-C_GZ7WV19_Xr13zCIboPoasWfkcETtxsYbwTLaPrPXxpLLW_gUXEGLZc8IIX7HZASgvw6yG9Hsaqi1mpeDxarKiBFQAqDjeVK-gsSOt2Kak1fAkICUgbkBgaDzP8sYXJjX3pUbUCK0VUJAbnymj0Eye0YQHI9G-g3bJRk--U3VAYkt8C4ocZgVwuEdpA-JqiqqhJ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