Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wllvm gllvm and the Linux kernel. #15

Closed
ianamason opened this issue Apr 23, 2018 · 6 comments
Closed

wllvm gllvm and the Linux kernel. #15

ianamason opened this issue Apr 23, 2018 · 6 comments

Comments

@ianamason
Copy link
Member

With respect to tinyconfig and the Linux kernel build:

  1. make sure wllvm and gclang behave the same.

  2. make sure extract-bc and get-bc behave the same (especially with respect to complaints).

@ianamason
Copy link
Member Author

ianamason commented Apr 28, 2018

Most of this has been fixed, and they now agree. It revealed quite a few bugs.
One bug it has revealed is the way we build bca files. Both wllvm and gllvm are
wrong here, as they squash many files (with the same name) but different paths
into one. Sometimes they squash to the same file, other times they do not.

E.g:

source_filename = "arch/x86/kernel/cpu/bugs.c"  is wllvm's version of bugs.bc
source_filename = "arch/x86/kernel/fpu/bugs.c" is gllvm's version of bugs.bc

This we have not yet fixed.

@ianamason
Copy link
Member Author

So it looks like we can get out all the files with the same name, but we need
to keep track of how many there are etc. Also both wllvm and gclang extraction
routines seem to be written under the assumption that you can extract trees from archives,
which does not seem to be justified by reality.

vagrant@ubuntu-xenial:~/linux_kernel/linux-stable/test$ ar -t built-in.o.new | grep core
core.o
core.o
uncore.o
core.o
core.o
core.o
core.o
mincore.o
core.o
syscore.o
vagrant@ubuntu-xenial:~/linux_kernel/linux-stable/test$ ar xN 1 built-in.o.new core.o
vagrant@ubuntu-xenial:~/linux_kernel/linux-stable/test$ ls -la core.o
-rw-r--r-- 1 vagrant vagrant 38048 Apr 30 23:11 core.o
vagrant@ubuntu-xenial:~/linux_kernel/linux-stable/test$ ar xN 2 built-in.o.new core.o
vagrant@ubuntu-xenial:~/linux_kernel/linux-stable/test$ ls -la core.o
-rw-r--r-- 1 vagrant vagrant 10960 Apr 30 23:11 core.o
vagrant@ubuntu-xenial:~/linux_kernel/linux-stable/test$

@ianamason
Copy link
Member Author

Does the code work for an archive that contains archives? Is that what is going on in the old wllvm tree walking code? @pmundkur suggested this twist.

@ianamason
Copy link
Member Author

Working with the fat version of built-in.a.new:

ar -t built-in.o.new | grep core
core.o
core.o
uncore.o
core.o
core.o
core.o
core.o
mincore.o
core.o
syscore.o
vagrant@ubuntu-xenial:~/linux_kernel/linux-stable/test$ ar xN 1 built-in.o.new core.o
vagrant@ubuntu-xenial:~/linux_kernel/linux-stable/test$ ls -la core.o
-rw-r--r-- 1 vagrant vagrant 38048 Apr 30 23:11 core.o
vagrant@ubuntu-xenial:~/linux_kernel/linux-stable/test$ ar xN 2 built-in.o.new core.o
vagrant@ubuntu-xenial:~/linux_kernel/linux-stable/test$ ls -la core.o
-rw-r--r-- 1 vagrant vagrant 10960 Apr 30 23:11 core.o

@ianamason
Copy link
Member Author

Just to add grist to the mill. I note that llvm-ar can itself make thin archives.

@ianamason
Copy link
Member Author

Leave the production of thin (bit code) archives for a rainy day.
Still have not seen evidence that people use bitcode archives.
Do they?

Both wllvm and gllvm have beed overhauled to handle archives properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant