LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-11-2009, 06:54 PM   #1
arvind.ayyangar
LQ Newbie
 
Registered: Aug 2006
Posts: 17

Rep: Reputation: 0
Adding loadable segment to binary


Hi all,
I am trying to add an additional code segment to an existing binary using the objcopy utility (--add-section). However, even after changing the flags of the section (code,alloc,etc), it does not add an entry to the program header and so the section is not loaded when the binary is executed.

While setting the section flags, i get a bfd warning..
BFD: stdiJ3Fi: warning: allocated section `.text.new' not in segment

How can I add a new text segment to an existing ELF binary ?
 
Old 01-12-2009, 03:16 AM   #2
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by arvind.ayyangar View Post
Hi all,
I am trying to add an additional code segment to an existing binary using the objcopy utility (--add-section). However, even after changing the flags of the section (code,alloc,etc), it does not add an entry to the program header and so the section is not loaded when the binary is executed.

While setting the section flags, i get a bfd warning..
BFD: stdiJ3Fi: warning: allocated section `.text.new' not in segment

How can I add a new text segment to an existing ELF binary ?
You said itself - you wanted to add SEGMENT , so --add-section is not suited.

ELF file as two "views" - one is sections and them used by linker in the link time and another - segments, them used by run-time loader (ld-linux) in the run-time.

I think program like elfsh (or something like) that can help you.

But what are you trying to accomplish ?
Sure adding additional segment is tool, but not a whole purpose ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
XOR Binary Stream Against a Known Binary Key telecom_is_me Programming 14 07-04-2008 08:10 PM
Do I need binary 1 and binary 2 dvd iso for base install? salah-ad-din Debian 5 08-15-2006 05:43 PM
adding binary numbers in java please help!! trscookie Programming 9 02-28-2006 04:16 PM
mbstring not loadable deweirdt Red Hat 0 06-24-2004 04:12 PM
loadable/LFS BigNate Linux From Scratch 4 04-08-2003 01:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration