Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gcc feature __attribute__ section to create the custom sections on the runtime #947

Open
azubieta opened this issue Apr 12, 2019 · 2 comments

Comments

@azubieta
Copy link
Contributor

azubieta commented Apr 12, 2019

While looking for a solution for AppImageCommunity/libappimage#21 I found this nice gcc feature that will save us a lot of "fragile" cmake code at https://github.com/AppImage/AppImageKit/blob/master/src/build-runtime.cmake

Basically to create a 10 bites long section named foo we would use the code below
char custom_section[10] __attribute__((section("foo"))) = {0x0};

Documentation can be found here http://www.keil.com/support/man/docs/armcc/armcc_chr1359124982450.htm

Here is an example of how it's used to append metadata to the linux kernel modules:
https://www.bottomupcs.com/elf-sections-others.xhtml#modinfo_sections

@TheAssassin
Copy link
Member

My plan for the future was to build a tool to take care of these things right before building the runtime, then build the runtime with it. We want to insert our magic bytes in a very custom location in the future, and that's the only way to do it properly.

That said, I'm open to using this extension. How well is that supported? Do other compilers (mainly clang) support that?

Can you run tests in AppImageBuild?

@azubieta
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants