Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* Re: Generating LLVM IR
       [not found] <YT3PR01MB8756D354EA9FC06D5009E205A0809@YT3PR01MB8756.CANPRD01.PROD.OUTLOOK.COM>
@ 2022-07-06 15:18 ` Nathan Chancellor
  0 siblings, 0 replies; only message in thread
From: Nathan Chancellor @ 2022-07-06 15:18 UTC (permalink / raw)
  To: Zhihao Lin; +Cc: clang-built-linux, llvm

Hi Zhihao,

On Wed, Jul 06, 2022 at 10:57:53AM +0000, Zhihao Lin wrote:
> Hello, I'm trying to build the kernel using LLVM and generate LLVM IR.
> In the makefile, I saw there is a target "dir/file.ll" provided.
> However, I want to add more attributes to the IR file generated, such
> as adding debug information. Is there any way to generate personalized
> IR by either modifying the Makefile or changing Makefile variables?

You can add additional flags to the "dir/file.ll" compiler invocation
with the KCFLAGS make variable:

$ make KCFLAGS="-ffoo -Wfoo" dir/file.ll

Additionally, there are kernel configurations, such as CONFIG_DEBUG_INFO
or CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT (depending on the kernel
version you are working against), which will add the compiler arguments
to generate debug info.

If you have any further questions, feel free to let us know! I have
added our new mailing list (llvm@lists.linux.dev) to the thread so it
can be archived at https://lore.kernel.org/llvm for future travellers,
please use that list if you start any new threads in the future :)

Cheers,
Nathan

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-06 15:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <YT3PR01MB8756D354EA9FC06D5009E205A0809@YT3PR01MB8756.CANPRD01.PROD.OUTLOOK.COM>
2022-07-06 15:18 ` Generating LLVM IR Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox