[lld] [DRAFT][clang-format][lld] Run clang-format on lld (PR #80461)
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 2 11:15:15 PST 2024
================
@@ -243,19 +241,21 @@ static const uint8_t tailMergeUnwindInfoX64[] = {
};
static const uint8_t thunkX86[] = {
- 0xB8, 0, 0, 0, 0, // mov eax, offset ___imp__<FUNCNAME>
- 0xE9, 0, 0, 0, 0, // jmp __tailMerge_<lib>
+ 0xB8, 0, 0, 0, 0, // mov eax, offset ___imp__<FUNCNAME>
+ 0xE9, 0, 0, 0, 0, // jmp __tailMerge_<lib>
};
static const uint8_t tailMergeX86[] = {
- 0x51, // push ecx
- 0x52, // push edx
- 0x50, // push eax
- 0x68, 0, 0, 0, 0, // push offset ___DELAY_IMPORT_DESCRIPTOR_<DLLNAME>_dll
- 0xE8, 0, 0, 0, 0, // call ___delayLoadHelper2 at 8
- 0x5A, // pop edx
- 0x59, // pop ecx
- 0xFF, 0xE0, // jmp eax
+ 0x51, // push ecx
+ 0x52, // push edx
+ 0x50, // push eax
+ 0x68, 0, 0,
----------------
MatzeB wrote:
should use `// clang-format off` here (or find other ways to express things that aren't mangled by clang-format).
```
static const uint8_t tailMergeX86[] = {
// clang-format off
0x51, // push ecx
0x52, // push edx
0x50, // push eax
0x68, 0, 0, 0, 0, // push offset ___DELAY_IMPORT_DESCRIPTOR_<DLLNAME>_dll
0xE8, 0, 0, 0, 0, // call ___delayLoadHelper2 at 8
0x5A, // pop edx
0x59, // pop ecx
0xFF, 0xE0, // jmp eax
// clang-format on
};
```
or another (admittedly not too great attempt) without clang-format:
```
#define INST(x) x
static const uint8_t tailMergeSequence[] = {
INST(0x51), // push ecx
INST(0x52), // push edx
INST(0x50), // push eax
INST(0x68, 0, 0, 0,
0), // push offset ___DELAY_IMPORT_DESCRIPTOR_<DLLNAME>_dll
INST(0xE8, 0, 0, 0, 0), // call ___delayLoadHelper2 at 8
INST(0x5A), // pop edx
INST(0x59), // pop ecx
INST(0xFF, 0xE0), // jmp eax
}
```
https://github.com/llvm/llvm-project/pull/80461
More information about the llvm-commits
mailing list