[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom rule to add ELF section to binary

From: Andy Falanga (afalanga)
Subject: Custom rule to add ELF section to binary
Date: Mon, 14 Mar 2016 23:19:52 +0000

I'm investigating a means of adding a section to the ELF binary being 
built.  The Shared Object file is a python module and I'm using this to 
do so:

I'm looking to embed certain, non-loadable, text information into the 
ELF binary; e.g. a legal notice.  I'm using objcopy to do this in a 
sandbox which *does not use* autotools.  For example,

g++ -o myprog main.cxx
echo "Some important legal notice" > legal_temp.txt
objcopy --add-section .legalnotice=legal_temp.txt 
--set-section-flags=noload,readonly myprog myprog.copy
mv myprog.copy myprog

I know how to place custom rules into  I'm doing so for 
some BUILT_SOURCES.  What I'm wondering now is, how would I add a rule 
for the output?  Could I add a rule for a single component object file, 
which is later linked into the library?  Which would be simplest?  How 
do figure out what the name of the target is that the autotools system 
makes?  They seem quite long and I don't want to hard-code a name that 
will not exist on all systems.  Is there some type of "Post Build" 
primary that I should use instead of trying a custom rule?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]