commit: 304a84419f73eb91f8c250c46f21b375b7777f96
parent d3bbf1c2a7776a643609069bb573cfc0bf28c4fa
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 21 Feb 2023 03:45:36 +0100
Add support for Pre-Compiled Headers (GCC, Clang)
Diffstat:
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/deblob.1 b/deblob.1
@@ -1,6 +1,6 @@
-.\" SPDX-FileCopyrightText: 2019-2022 deblob Authors <https://hacktivis.me/projects/deblob>
+.\" SPDX-FileCopyrightText: 2019-2023 deblob Authors <https://hacktivis.me/projects/deblob>
.\" SPDX-License-Identifier: BSD-3-Clause
-.Dd 2022-02-18
+.Dd 2023-02-21
.Dt DEBLOB 1
.Os
.Sh NAME
@@ -85,6 +85,8 @@ Emacs Lisp Bytecode
Ren'Py Archives v1/v2/v3
.It
Squirrel bytecode
+.It
+Pre-Compiled Headers: Clang, GCC
.El
.Sh EXAMPLES
The following code block shows how it can be used in Gentoo's
diff --git a/main.ha b/main.ha
@@ -1,4 +1,4 @@
-// Copyright © 2019-2022 deblob Authors <https://hacktivis.me/projects/deblob>
+// Copyright © 2019-2023 deblob Authors <https://hacktivis.me/projects/deblob>
// SPDX-License-Identifier: BSD-3-Clause
use bytes;
use endian;
@@ -56,6 +56,18 @@ const magic: [_][]u8 = [
['R', 'P', 'A', '-', '3', '.', '0', ' '], // Ren'Py Archive v3
[0xFA, 0xFA], // Squirrel bytecode
+
+ ['C', 'P', 'C', 'H'],
+ // Clang Pre-Compiled-Header, followed by Info Block, see:
+ // - clang/lib/Serialization/ASTWriter.cpp ASTWriter::WriteAST
+ // - clang/lib/Serialization/ASTReader.cpp doesntStartWithASTFileMagic
+ // Excluded from fixtures (200KB+), test with:
+ // echo > empty.h && clang -cc1 -nobuiltininc -emit-pch -o empty.h.pch empty.h
+
+ ['g', 'p', 'c', 'h'],
+ // GCC Pre-Compiled-Header
+ // Excluded from fixtures (1.2MB+), test with:
+ // echo > empty.h && gcc empty.h
];
const dos_magic: []u8 = ['M', 'Z'];
const pe_magic: []u8 = ['P', 'E', 0x00, 0x00];