Paarth
Paarth

Reputation: 171

Efficiently adding a new section in an ELF file

I want to add a new section to an ELF file (say E) which stores the integrity hash of .text section. Assume I chunk the .text section into T1,T2..Tn and get the hash H1,H2..Hn and add all hashes to the E in a new .my_hash section.

One naive way to do this would be to

Any better way to do this?

Upvotes: 3

Views: 3906

Answers (1)

Tom Tromey
Tom Tromey

Reputation: 22519

Use objcopy --add-section. You may want --set-section-flags as well.

Upvotes: 4

Related Questions