SYNOPSIS
re [ options ] <executable file> <symbol file>
DESCRIPTION
re is the resource editor. The resource editor is a tool
that takes as input an ELF executable binary file, and a
generic binary file, and generates as output a new ELF
executable with one of it's resources replaced by the new
binary file. The executable must have had it's resources
compiled using rc, the symbol table must be present (the
executable must not be stripped), and in most cases must
have been linked with the -q or --emit-relocs option on
the ld linker.
A resource is a pair of symbols (variables) in an exe
cutable or relocatable object file. The first symbol is an
array of bytes containing data the program uses, and the
second is an integer containing the size of the first sym
bol. Resources provide a method of easily using binary
data within C programs, and of flexibly changing this data
after compilation.
The name of the symbols are determined by the input file
name, unless the -s ot -l options are used. The first
symbol (the data variable, known as the `data symbol') is
named the same as the file, less the path and everything
past the first `.'. The second symbol (known as the
`length symbol') is named the same as the first, with
`_len' appended.
re often requires the ELF executable it is modifying to
contain the relocation sections which were used when link
ing to resolve symbol references in the original object
files. This is only required if the new resource is larger
than the old resource. The reason for this is that since
the new resource is larger, any symbols or sections after
the symbol in the ELF executable will have changed
address/offset, and so their references in the code
(.text, .init, .plt) must be updated.
If the new resource is smaller or equal size, the reloca
tions section is not needed; the old resource is overwrit
ten, and padded with 0's if smaller, so that the resource
takes up the same size as before in the file. Of course,
the resource length variable is updated to the correct
size so the executable runs as expected.
OPTIONS
-d Show debugging information
-h Show help
cutable file is saved as `new':
$ re -o new old icon.png
This next example does the same as above, but changes the
symbols `img' and `imgLen' in old:
$ re -o new -s img -l imgLen old icon.png
AUTHOR
Written by Jeff Williams <minimalism@somaradio.ca>
REPORTING BUGS
Report bugs to <minimalism@somaradio.ca>.
SEE ALSO
rc(1), gcc(1), ld(1), objcopy(1), objdump(1), readelf(1),
and elf(5).
Jeff Williams 0.03 re(1)
Man(1) output converted with
man2html