You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Building the linux kernel from llvm bitcode requires writing scripts to copy, extract and recompile a lot of files in the right order.
3
+
## A script is only valid for one configuration of the kernel
4
+
5
+
## The goal of this Python script is to automate the script building process for any configuration of the kernel.
6
+
7
+
## It takes one or more argument : the first argument is where to write the final script, and all the others are paths to files of which we should not use the bitcode.
8
+
9
+
importsys,os
10
+
importsubprocess
11
+
12
+
# This is where most of the script gets written.
13
+
# This function takes as argument:
14
+
# a list of path that should not be translated into bitcode
15
+
# the depth from the root (this is a recursive function)
16
+
# the path from the root to the current folder (its length should be depth)
# In directories we store the list of depth 1 directories (and files) found in builtin
24
+
directories=[]
25
+
forlineinbuiltin.readlines():
26
+
line=line.split('\n')[0]
27
+
words=line.split('/')
28
+
ifwords[0]=="arch": # We had to make an exception for the arch folder which does not have a built-in.o at the root.
29
+
words[0]=words[0]+'/'+words[1]
30
+
ifwords[2] inarchbi: #A second exception for arch, not all files in the folder are referenced in the arch/x86/built-in.o. We store the exceptions in the archi list
31
+
words[0]=words[0]+'/'+words[2]
32
+
ifwords[depth] notindirectoriesandlinenotinstandalone_objects: #Some objects are not listed in a built-in.o except at the root, so we include them separately in order not to mess the order of linking
33
+
directories.append(words[depth])
34
+
35
+
# folders in which there are excluded folders which we will need to act on recursively
# When dealing with a folder, we get the bitcode from the built-in.o file and check for errors in the log.
62
+
# For each file that does not have a bitcode version (compiled straight from assembly) we copy it into the build folder directly and add it to the linker args
0 commit comments