Peng Yu via llvm-dev
2019-Jan-28 14:51 UTC
[llvm-dev] How to generate .bc file using configure && make on Mac OS X?
On Mon, Jan 28, 2019 at 8:16 AM Tim Northover <t.p.northover at gmail.com> wrote:> > On Mon, 28 Jan 2019 at 14:10, Peng Yu via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > ld: unknown option: -plugin-opt=save-temps > > The macOS linker supports -save-temps directly (but not -plugin-opt). > I haven't tried, but I'd guess that if you modified the -Wl part of > your command line in the obvious manner it'll work.I can run the configure using this command. ../../../extract/bash-5.0/configure CC=clang CXX=clang++ RANLIB=llvm-ranlib CFLAGS=-g\ -flto LDFLAGS=-save-temps\ -flto But the command to generate the executable "bash" (called by make) does not produce a .bc file. clang -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob -L./lib/tilde -L./lib/sh -save-temps -flto -g -flto -Wno-parentheses -Wno-format-security -o bash shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o expr.o flags.o jobs.o subst.o hashcmd.o hashlib.o mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o alias.o array.o arrayfunc.o assoc.o braces.o bracecomp.o bashhist.o bashline.o list.o stringlib.o locale.o findcmd.o redir.o pcomplete.o pcomplib.o syntax.o xmalloc.o -lbuiltins -lglob -lsh -lreadline -lhistory -ltermcap -ltilde lib/intl/libintl.a -liconv -liconv -ldl It is just the .o files are bitcode. But bash is an executable. And there are not .bc files accompanying it. $ file bash bash: Mach-O 64-bit executable x86_64 Using the original commands on Linux, I got the following associated files. ./configure CC=clang RANLIB=llvm-ranlib CFLAGS=-flto LDFLAGS=-Wl\,-plugin-opt=save-temps\ -flto\ -fuse-ld=gold make $ ls -gltr bash.*.bc -rw-r--r-- 1 staff 4769876 Jan 25 10:16 bash.0.0.preopt.bc -rw-r--r-- 1 staff 4769876 Jan 25 10:16 bash.0.2.internalize.bc -rw-r--r-- 1 staff 4739688 Jan 25 10:16 bash.0.4.opt.bc -rw-r--r-- 1 staff 4739688 Jan 25 10:16 bash.0.5.precodegen.bc -- Regards, Peng
Jakub (Kuba) Kuderski via llvm-dev
2019-Jan-28 15:34 UTC
[llvm-dev] How to generate .bc file using configure && make on Mac OS X?
Peng, You can also try using the gllvm wrapper: https://github.com/SRI-CSL/gllvm ; it's quite reliable and easy to use in my experience. -JK On Mon, Jan 28, 2019 at 9:51 AM Peng Yu via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On Mon, Jan 28, 2019 at 8:16 AM Tim Northover <t.p.northover at gmail.com> > wrote: > > > > On Mon, 28 Jan 2019 at 14:10, Peng Yu via llvm-dev > > <llvm-dev at lists.llvm.org> wrote: > > > ld: unknown option: -plugin-opt=save-temps > > > > The macOS linker supports -save-temps directly (but not -plugin-opt). > > I haven't tried, but I'd guess that if you modified the -Wl part of > > your command line in the obvious manner it'll work. > > I can run the configure using this command. > > ../../../extract/bash-5.0/configure CC=clang CXX=clang++ > RANLIB=llvm-ranlib CFLAGS=-g\ -flto LDFLAGS=-save-temps\ -flto > > But the command to generate the executable "bash" (called by make) > does not produce a .bc file. > > clang -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob > -L./lib/tilde -L./lib/sh -save-temps -flto -g -flto > -Wno-parentheses -Wno-format-security -o bash shell.o eval.o y.tab.o > general.o make_cmd.o print_cmd.o dispose_cmd.o execute_cmd.o > variables.o copy_cmd.o error.o expr.o flags.o jobs.o subst.o hashcmd.o > hashlib.o mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o > test.o version.o alias.o array.o arrayfunc.o assoc.o braces.o > bracecomp.o bashhist.o bashline.o list.o stringlib.o locale.o > findcmd.o redir.o pcomplete.o pcomplib.o syntax.o xmalloc.o > -lbuiltins -lglob -lsh -lreadline -lhistory -ltermcap -ltilde > lib/intl/libintl.a -liconv -liconv -ldl > > It is just the .o files are bitcode. But bash is an executable. And > there are not .bc files accompanying it. > > $ file bash > bash: Mach-O 64-bit executable x86_64 > > Using the original commands on Linux, I got the following associated files. > ./configure CC=clang RANLIB=llvm-ranlib CFLAGS=-flto > LDFLAGS=-Wl\,-plugin-opt=save-temps\ -flto\ -fuse-ld=gold > make > > $ ls -gltr bash.*.bc > -rw-r--r-- 1 staff 4769876 Jan 25 10:16 bash.0.0.preopt.bc > -rw-r--r-- 1 staff 4769876 Jan 25 10:16 bash.0.2.internalize.bc > -rw-r--r-- 1 staff 4739688 Jan 25 10:16 bash.0.4.opt.bc > -rw-r--r-- 1 staff 4739688 Jan 25 10:16 bash.0.5.precodegen.bc > > -- > Regards, > Peng > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Jakub Kuderski -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190128/7caa78d7/attachment.html>
Peng Yu via llvm-dev
2019-Jan-28 16:24 UTC
[llvm-dev] How to generate .bc file using configure && make on Mac OS X?
This works great.> You can also try using the gllvm wrapper: https://github.com/SRI-CSL/gllvm ; it's quite reliable and easy to use in my experience.Just to be sure. Only one version of bc file will be generated that corresponds to the compiler options provide at configure? The original approach using ld.gold will provide several .bc files that correspond to different stages of the optimization. I think using gllvm, I need to specify the corresponding -O? option to the correct optimization stage of the bc file? Thanks. -- Regards, Peng