Keil Logo

Options to protect code in object files with fromelf

14.4 Options to protect code in object files with fromelf

If you are delivering objects to third parties, then you might want to protect the code they contain.

To help you to protect this code, fromelf provides the --strip option and the --privacy option. These options remove or obscure the symbol names in the object. The option you choose depends on how much information you want to remove. The effect of these options is different for object files.

Restrictions

You must use --elf with these options. Because you have to use --elf, you must also use --output.

Effect of the --privacy and --strip options for protecting code in object files

Option Local symbols Section names Mapping symbols Build attributes
fromelf --elf ‑‑privacy

Removes those local symbols that can be removed without loss of functionality.

Symbols that cannot be removed, such as the targets for relocations, are kept. For these symbols, the names are removed. These are marked as [Anonymous Symbol] in the fromelf --text output.

Gives section names a default value. For example, changes code section names to '.text'

Present Present
fromelf --elf ‑‑strip=symbols

Removes those local symbols that can be removed without loss of functionality.

Symbols that cannot be removed, such as the targets for relocations, are kept. For these symbols, the names are removed. These are marked as [Anonymous Symbol] in the fromelf --text output.

Section names remain the same

Present Present
fromelf --elf ‑‑strip=localsymbols

Removes those local symbols that can be removed without loss of functionality.

Symbols that cannot be removed, such as the targets for relocations, are kept. For these symbols, the names are removed. These are marked as [Anonymous Symbol] in the fromelf --text output.

Section names remain the same

Present Present

Example

To produce a new ELF object with the complete symbol table removed and various section names changed, enter:

fromelf --elf --privacy --output=outfile.o infile.o
Non-ConfidentialPDF file icon PDF version100748_0614_00_en
Copyright © 2016–2020 Arm Limited or its affiliates. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.