[llvm-dev] Global Variable with ELF Custom Section

Wehrli Johan via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 6 00:58:30 PDT 2016


Hi everyone,

I have created a custom section in an ELF file with the following code:

GlobalVariable* glob = new GlobalVariable(*mod, type, true, GlobalValue::ExternalLinkage, “test", “myGlobal”);
glob->setSection(“.custom”);

This works great but I have two questions:

	- Can I pass more parameters to the section (like the elf type, the elf flag, etc.). In a macho, you can add information like cstring_literals or no_dead_strip. I did not find anything like it for ELF.
	- When i used the flag -Wl,—gc-sections on Linux, my section is deleted, can I bypass this?

Greetings,

Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160406/d743212c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160406/d743212c/attachment.sig>


More information about the llvm-dev mailing list