Adding an LLVM Optimization Pass while Building openSSL Using Clang

Matt Caswell matt at openssl.org
Tue Apr 2 07:57:08 UTC 2024



On 02/04/2024 03:11, Ange-Thierry Ishimwe wrote:
> Hi all,
> 
> I am currently working on building OpenSSL for RISC-V architecture using 
> clang/llvm. While I've successfully compiled OpenSSL and generated a 
> binary using the linux64-riscv64 configuration, I would like to 
> integrate an LLVM optimization pass into the compilation process before 
> the object files are created.
> 
> *_Traditionally, the OpenSSL process follows the pattern:_*
> clang [source file] -o [obj file]
> 
> *_However, my objective is to introduce an additional step in the 
> process, as follows:
> _clang *[source file] -o [LLVM IR File]
> *opt *[LLVM IR File] -o [OPTIMIZED LLVM IR File]
> *clang *[OPTIMIZED LLVM IR File] -o [obj file]
> 
> Basically, I want to create intermediate representations (IR), apply a 
> custom optimization pass on them, and subsequently produce an object 
> file on all the source files.
> 
> Could I please get some guidance or point me in the right direction on 
> how to achieve this within the OpenSSL build process?
> 
> Your assistance would be greatly appreciated.

I've not tried this, but my immediate thought would be to wrap the 3 
step process up in a shell script and then use your shell script as the 
"compiler", e.g.


CC=myscript.sh ./config ...


Matt



More information about the openssl-users mailing list