# How to disable C extension in RISC-V compiler

**URL:** <https://forums.sifive.com/t/how-to-disable-c-extension-in-risc-v-compiler/2713>\
**Category:** RISC-V\
**Created:** [August 7, 2019, 11:03am UTC](https://forums.sifive.com/t/how-to-disable-c-extension-in-risc-v-compiler/2713 "2019-08-07T11:03:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zerox100](https://avatars.discourse-cdn.com/v4/letter/z/bcef8e/32.png) [@zerox100](https://forums.sifive.com/u/zerox100)\
**Post date:** [August 7, 2019, 11:03am UTC](https://forums.sifive.com/t/how-to-disable-c-extension-in-risc-v-compiler/2713/1 "2019-08-07T11:03:16Z")

</div>

I have segger embedded studio for RISC-V. I want to disable C extension in RISC-V compiler. But i dont know how can i do that?

Any idea is welcomed

---

<div class="post-metadata">

**Author:** ![jimw](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@jimw](https://forums.sifive.com/u/jimw)\
**Post date:** [August 7, 2019, 4:15pm UTC](https://forums.sifive.com/t/how-to-disable-c-extension-in-risc-v-compiler/2713/2 "2019-08-07T16:15:28Z")

</div>

To compile without the C extension, specify a -march option without the C extension. If you are currently compiling for -march=rv32imac then compile for -march=rv32ima to get the same code without the C extension.

That tells the compiler to stop generating C instructions, but your precompiled libraries may still be using the C extension. The compiler has multilib support, so it has libraries built with multiple march and mabi values, but we don’t have a complete set as there are a lot of possible combinations. I don’t think that rv32ima is one of the current ones, but rv32im is so you could try that instead if you don’t need the A extension. You can see the set of libraries by passing the --print-multi-lib option to gcc.

If writing assembly language code, you can turn of the C extension with “.option norvc” and can turn it on with “.option rvc”. You can also use “.option push” before changing a setting, and then use “.option pop” later to restore the original settings.
