public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ayush Singh" <ayushdevel1325@gmail.com>
To: edk2-devel-groups-io <devel@edk2.groups.io>
Cc: Mike Kinney <michael.d.kinney@intel.com>,
	"mikuback@linux.microsoft.com" <mikuback@linux.microsoft.com>,
	Andrew Fish <afish@apple.com>,
	"Gaibusab, Jabeena B" <jabeena.b.gaibusab@intel.com>,
	"Yao, Jiewen" <jiewen.yao@intel.com>
Subject: Building C static Library for UEFI
Date: Sat, 30 Jul 2022 19:55:31 +0530	[thread overview]
Message-ID: <19101926-8aa0-8424-444b-495386572c74@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]

Hello everyone. There are some tests in Rust std that statically link to 
a C static library to check ffi. Since if Rust is ever used in edk2, it 
would probably have to integrate with the existing C code. Thus, I 
thought rather than ignoring these tests, I wanted to make them work.

What Rust cargo needs is a static C library (`.lib`) to link against. I 
was not really able to find much about linking in UEFI applications. 
However, from what I understand [1], edk2 already does do static link 
for C modules, so it should technically be the same for Rust as well as 
long as a static library can be generated from C code. I did look at the 
`build_rules` [2], but I don't know where the flags are defined. I think 
following rules: `C-Code-File` -> `Object-File` should technically 
create a static library, but would it work with projects outside edk2? 
Also, it would be great if someone can also help me with the flags that 
need to be supplied if it can.


Yours Sincerely

Ayush Singh


[1]: 
https://edk2-docs.gitbook.io/edk-ii-build-specification/9_build_or_make_stage/95_dynamic_link

[2]: 
https://github.com/tianocore/edk2/blob/e9150618ec91f79e70a1719ac8c198bee34a99be/BaseTools/Conf/build_rule.template

[-- Attachment #2: Type: text/html, Size: 1892 bytes --]

             reply	other threads:[~2022-07-30 14:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-30 14:25 Ayush Singh [this message]
2022-08-09 18:32 ` [edk2-devel] Building C static Library for UEFI Andrew Fish
2022-08-10 14:18   ` Ayush Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19101926-8aa0-8424-444b-495386572c74@gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox