LinuxQuestions.org
Visit the LQ Articles and Editorials section
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
 
LinkBack Search this Thread
Old 01-11-2009, 05: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, 02:16 AM   #2
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 595

Rep: Reputation: 103Reputation: 103
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are 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 07:10 PM
Do I need binary 1 and binary 2 dvd iso for base install? salah-ad-din Debian 5 08-15-2006 04:43 PM
adding binary numbers in java please help!! trscookie Programming 9 02-28-2006 03:16 PM
mbstring not loadable deweirdt Red Hat 0 06-24-2004 03:12 PM
loadable/LFS BigNate Linux From Scratch 4 04-08-2003 12:46 PM


All times are GMT -5. The time now is 05:21 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration