Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
diffoscope
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reproducible Builds
diffoscope
Commits
17b7c1f9
Commit
17b7c1f9
authored
8 years ago
by
Ximin Luo
Browse files
Options
Downloads
Patches
Plain Diff
Add support for reading LLVM bitcode files
parent
041ad950
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
diffoscope/__init__.py
+8
-0
8 additions, 0 deletions
diffoscope/__init__.py
diffoscope/comparators/__init__.py
+2
-0
2 additions, 0 deletions
diffoscope/comparators/__init__.py
diffoscope/comparators/llvm.py
+44
-0
44 additions, 0 deletions
diffoscope/comparators/llvm.py
with
54 additions
and
0 deletions
diffoscope/__init__.py
+
8
−
0
View file @
17b7c1f9
...
...
@@ -109,6 +109,14 @@ class RequiredToolNotFound(Exception):
'
debian
'
:
'
default-jdk | java-sdk
'
,
'
arch
'
:
'
java-environment
'
,
},
'
llvm-bcanalyzer
'
:
{
'
debian
'
:
'
llvm
'
,
'
arch
'
:
'
llvm
'
,
},
'
llvm-dis
'
:
{
'
debian
'
:
'
llvm
'
,
'
arch
'
:
'
llvm
'
,
},
'
ls
'
:
{
'
debian
'
:
'
coreutils
'
,
'
arch
'
:
'
coreutils
'
,
...
...
This diff is collapsed.
Click to expand it.
diffoscope/comparators/__init__.py
+
2
−
0
View file @
17b7c1f9
...
...
@@ -59,6 +59,7 @@ from diffoscope.comparators.image import ImageFile
from
diffoscope.comparators.ipk
import
IpkFile
from
diffoscope.comparators.iso9660
import
Iso9660File
from
diffoscope.comparators.json
import
JSONFile
from
diffoscope.comparators.llvm
import
LlvmBitCodeFile
from
diffoscope.comparators.macho
import
MachoFile
from
diffoscope.comparators.mono
import
MonoExeFile
from
diffoscope.comparators.pdf
import
PdfFile
...
...
@@ -147,6 +148,7 @@ FILE_CLASSES = (
MachoFile
,
FsImageFile
,
StaticLibFile
,
LlvmBitCodeFile
,
Sqlite3Database
,
TtfFile
,
MoFile
,
...
...
This diff is collapsed.
Click to expand it.
diffoscope/comparators/llvm.py
0 → 100644
+
44
−
0
View file @
17b7c1f9
# -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2015 Jérémy Bobbio <lunar@debian.org>
# Copyright © 2016 Ximin Luo <infinity0@debian.org>
#
# diffoscope is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# diffoscope is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope. If not, see <http://www.gnu.org/licenses/>.
from
diffoscope
import
tool_required
from
diffoscope.comparators.binary
import
File
from
diffoscope.comparators.utils
import
Command
from
diffoscope.difference
import
Difference
class
LlvmBcAnalyzer
(
Command
):
@tool_required
(
'
llvm-bcanalyzer
'
)
def
cmdline
(
self
):
return
[
'
llvm-bcanalyzer
'
,
'
-dump
'
,
self
.
path
]
class
LlvmBcDisassembler
(
Command
):
@tool_required
(
'
llvm-dis
'
)
def
cmdline
(
self
):
return
[
'
llvm-dis
'
,
'
-o
'
,
'
-
'
,
self
.
path
]
class
LlvmBitCodeFile
(
File
):
@staticmethod
def
recognizes
(
file
):
return
file
.
magic_file_type
and
file
.
magic_file_type
.
startswith
(
'
LLVM IR bitcode
'
)
def
compare_details
(
self
,
other
,
source
=
None
):
return
[
Difference
.
from_command
(
LlvmBcAnalyzer
,
self
.
path
,
other
.
path
),
Difference
.
from_command
(
LlvmBcDisassembler
,
self
.
path
,
other
.
path
)]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment