LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - General
User Name
Password
Linux - General This 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
 
Thread Tools Search this Thread
Old 01-11-2009, 06:54 PM   #1
arvind.ayyangar
LQ Newbie
 
Registered: Aug 2006
Posts: 17
Thanked: 0
Adding loadable segment to binary


[Log in to get rid of this advertisement]
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 ?
arvind.ayyangar is offline     Reply With Quote
Old 01-12-2009, 03:16 AM   #2
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 337
Thanked: 35
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 ?
Valery Reznic is offline     Reply With Quote

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


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


All times are GMT -5. The time now is 04: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.
Advertisement
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Click Here to receive a complimentary subscription courtesy of LQ.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration