NASM - The Netwide Assembler
NASM Forum => Programming with NASM => Topic started by: sy1234 on March 29, 2011, 08:03:07 PM
-
How can I declare/define an elf "comdat" section with nasm?
Thanks.
-
http://www.nasm.us/xdoc/2.09.07/html/nasmdoc6.html#section-6.7
(there's some further information in the "elf" section of the Friendly Manual)
Will this do what you want? Looks like it, but I've never used it. Looks like this applies to individual variables, not to an entire section - so it may not be exactly what you want... If you learn anything, pass it on !
Best,
Frank
-
Unfortunately, that's not what I want.
In digging deeper, I guess what I'm interested in is .gnu.linkonce, as described here:
http://sourceware.org/binutils/docs-2.20/as/Section.html#Section
If you compile any C++ inlined code with gcc (on Linux), like the following:
struct foo { static void bar() {} };
int main() { foo::bar(); }
its (gas) listing will include the following:
.section .text._ZN3foo3barEv,"axG",@progbits,_ZN3foo3barEv,comdat
that is, a section named ".text._ZN3foo3barEv" that's part of a group that's marked as "comdat" or "linkonce".
I need to reproduce the same thing with nasm.
Thanks.