* Using objdump to force a section to load with gdb.
@ 1999-07-01 0:00 Brendan Simon
1999-07-01 0:00 ` objdump or gdb to force a section to load ? Brendan Simon
1999-07-01 0:00 ` Using objdump to force a section to load with gdb Ian Lance Taylor
0 siblings, 2 replies; 8+ messages in thread
From: Brendan Simon @ 1999-07-01 0:00 UTC (permalink / raw)
To: binutils, Dan Malek, Magnus Damm, gdb
I have a linux kernel compiled for a mpc860 target and am trying to get
it to run by downloading it into memory using a background debugger
(BDM). The boot code gets to the point where it trys to uncompress the
kernel but fails because the image isn't loaded into memory (only .text,
.rodata and .data are loaded). I tried using objcopy to set the "image"
section to "load" but it does not seem to work. How can I get gdb to
load the image section (either using a gdb command or binutils) ?
Thanks,
Brendan Simon.
Here is a before/after trace using objcopy --set-section-flags. As you
can see, the load attribute is not set. I've tried all combinations of
attributes but I can't get it to work. Am I doing something wrong ?
powerpc-linux-objdump --section-headers myzimage
myzimage: file format elf32-powerpc
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00004324 00100000 00100000 00010000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .rodata 00000460 00104330 00104330 00014330 2**4
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .data 000002f8 00105000 00105000 00015000 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .bss 0000bbac 00106000 00106000 00016000 2**2
ALLOC
4 image 0006ccbf 00000000 00000000 00016000 2**0
CONTENTS, READONLY
powerpc-linux-objcopy --set-section-flags=image=load myzimage
powerpc-linux-objdump --section-headers myzimage
myzimage: file format elf32-powerpc
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00004324 00100000 00100000 00010000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .rodata 00000460 00104330 00104330 00014330 2**4
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .data 000002f8 00105000 00105000 00015000 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .bss 0000bbac 00106000 00106000 00016000 2**2
ALLOC
4 image 0006ccbf 00000000 00000000 00016000 2**0
CONTENTS
^ permalink raw reply [flat|nested] 8+ messages in thread
* objdump or gdb to force a section to load ?
1999-07-01 0:00 Using objdump to force a section to load with gdb Brendan Simon
@ 1999-07-01 0:00 ` Brendan Simon
1999-07-01 0:00 ` Jonathan Larmour
1999-07-01 0:00 ` Using objdump to force a section to load with gdb Ian Lance Taylor
1 sibling, 1 reply; 8+ messages in thread
From: Brendan Simon @ 1999-07-01 0:00 UTC (permalink / raw)
To: binutils, Dan Malek, Magnus Damm, gdb
I sent this a while ago and got no response. I'm resending it just in case
it got lost.
Sorry if you have already received this before.
Brendan Simon.
Brendan Simon wrote:
> I have a linux kernel compiled for a mpc860 target and am trying to get
> it to run by downloading it into memory using a background debugger
> (BDM). The boot code gets to the point where it trys to uncompress the
> kernel but fails because the image isn't loaded into memory (only .text,
> .rodata and .data are loaded). I tried using objcopy to set the "image"
> section to "load" but it does not seem to work. How can I get gdb to
> load the image section (either using a gdb command or binutils) ?
>
> Here is a before/after trace using objcopy --set-section-flags. As you
> can see, the load attribute is not set. I've tried all combinations of
> attributes but I can't get it to work. Am I doing something wrong ?
>
> powerpc-linux-objdump --section-headers myzimage
> myzimage: file format elf32-powerpc
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 00004324 00100000 00100000 00010000 2**2
> CONTENTS, ALLOC, LOAD, READONLY, CODE
> 1 .rodata 00000460 00104330 00104330 00014330 2**4
> CONTENTS, ALLOC, LOAD, READONLY, DATA
> 2 .data 000002f8 00105000 00105000 00015000 2**2
> CONTENTS, ALLOC, LOAD, DATA
> 3 .bss 0000bbac 00106000 00106000 00016000 2**2
> ALLOC
> 4 image 0006ccbf 00000000 00000000 00016000 2**0
> CONTENTS, READONLY
>
> powerpc-linux-objcopy --set-section-flags=image=load myzimage
>
> powerpc-linux-objdump --section-headers myzimage
> myzimage: file format elf32-powerpc
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 00004324 00100000 00100000 00010000 2**2
> CONTENTS, ALLOC, LOAD, READONLY, CODE
> 1 .rodata 00000460 00104330 00104330 00014330 2**4
> CONTENTS, ALLOC, LOAD, READONLY, DATA
> 2 .data 000002f8 00105000 00105000 00015000 2**2
> CONTENTS, ALLOC, LOAD, DATA
> 3 .bss 0000bbac 00106000 00106000 00016000 2**2
> ALLOC
> 4 image 0006ccbf 00000000 00000000 00016000 2**0
> CONTENTS
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: objdump or gdb to force a section to load ?
1999-07-01 0:00 ` objdump or gdb to force a section to load ? Brendan Simon
@ 1999-07-01 0:00 ` Jonathan Larmour
[not found] ` <376981EF.BE10D7C8@dgs.monash.edu.au>
0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Larmour @ 1999-07-01 0:00 UTC (permalink / raw)
To: brendan; +Cc: binutils, Dan Malek, Magnus Damm, gdb
In article < 37685993.EB50E446@dgs.monash.edu.au > you write:
>I sent this a while ago and got no response. I'm resending it just in case
>it got lost.
All of 24 hours before. Perhaps you need to be more patient.
>> I have a linux kernel compiled for a mpc860 target and am trying to get
>> it to run by downloading it into memory using a background debugger
>> (BDM). The boot code gets to the point where it trys to uncompress the
>> kernel but fails because the image isn't loaded into memory (only .text,
>> .rodata and .data are loaded). I tried using objcopy to set the "image"
>> section to "load" but it does not seem to work. How can I get gdb to
>> load the image section (either using a gdb command or binutils) ?
If it isn't marked as loadable, then you probably can't. It hasn't even got
an address for it to be loaded into. If it is to be loaded then it is the
build process (using the linker script) that has to make it loadable.
Perhaps an easier approach would be to use an uncompressed kernel rather than
a zImage.
A ppc-linux list may be able to give more specific advice about why the
linker scripts are the way they are.
Jifl
--
Cygnus Solutions, 35 Cambridge Place, Cambridge, UK. Tel: +44 (1223) 728762
"I used to have an open mind but || Get yer free open source RTOS's here...
my brains kept falling out." || http://sourceware.cygnus.com/ecos
Help fight spam! http://spam.abuse.net/ These opinions are all my own fault
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Using objdump to force a section to load with gdb.
1999-07-01 0:00 Using objdump to force a section to load with gdb Brendan Simon
1999-07-01 0:00 ` objdump or gdb to force a section to load ? Brendan Simon
@ 1999-07-01 0:00 ` Ian Lance Taylor
1999-07-01 0:00 ` Brendan Simon
1 sibling, 1 reply; 8+ messages in thread
From: Ian Lance Taylor @ 1999-07-01 0:00 UTC (permalink / raw)
To: brendan; +Cc: binutils, dmalek, eramdam, gdb
Date: Wed, 16 Jun 1999 00:06:11 +0000
From: Brendan Simon <brendan@dgs.monash.edu.au>
I have a linux kernel compiled for a mpc860 target and am trying to get
it to run by downloading it into memory using a background debugger
(BDM). The boot code gets to the point where it trys to uncompress the
kernel but fails because the image isn't loaded into memory (only .text,
.rodata and .data are loaded). I tried using objcopy to set the "image"
section to "load" but it does not seem to work. How can I get gdb to
load the image section (either using a gdb command or binutils) ?
The problem with using objcopy to set the LOAD flag is that the only
sections which are loaded are those which are stored in program
segments. objcopy isn't prepared to create a new program segment in
order to change a section flag. This would be difficult to fix.
If your loader reads the section headers rather than the segment
headers, then you may be able to make this work by doing something
like
powerpc-linux-objcopy --set-section-flags=image=alloc,load myzimage
The reason is that ELF records the ALLOC flag in the section header,
and objcopy should know how to change that.
The best way to make a loadable section is to mark the section as
loadable in the first place. See the gas documentation for how to set
the section flags when using the .section directive.
Ian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Using objdump to force a section to load with gdb.
1999-07-01 0:00 ` Using objdump to force a section to load with gdb Ian Lance Taylor
@ 1999-07-01 0:00 ` Brendan Simon
1999-07-01 0:00 ` Ian Lance Taylor
0 siblings, 1 reply; 8+ messages in thread
From: Brendan Simon @ 1999-07-01 0:00 UTC (permalink / raw)
To: Ian Lance Taylor, binutils
Ian Lance Taylor wrote:
> The problem with using objcopy to set the LOAD flag is that the only
> sections which are loaded are those which are stored in program
> segments. objcopy isn't prepared to create a new program segment in
> order to change a section flag. This would be difficult to fix.
>
> If your loader reads the section headers rather than the segment
> headers, then you may be able to make this work by doing something
> like
> powerpc-linux-objcopy --set-section-flags=image=alloc,load myzimage
> The reason is that ELF records the ALLOC flag in the section header,
> and objcopy should know how to change that.
>
> The best way to make a loadable section is to mark the section as
> loadable in the first place. See the gas documentation for how to set
> the section flags when using the .section directive.
I'm not sure if this is applicable when the section is added with "objcopy
--add-section=image=vmlinux.gz", where vmlinux.gz is an elf file that has been
compressed with gzip. How does one add this file as a section to an existing
elf file (bootloader) as "loadable in the first place" ?
Brendan Simon.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Using objdump to force a section to load with gdb.
1999-07-01 0:00 ` Brendan Simon
@ 1999-07-01 0:00 ` Ian Lance Taylor
0 siblings, 0 replies; 8+ messages in thread
From: Ian Lance Taylor @ 1999-07-01 0:00 UTC (permalink / raw)
To: brendan; +Cc: binutils
Date: Fri, 18 Jun 1999 06:50:53 +0000
From: Brendan Simon <brendan@dgs.monash.edu.au>
> The best way to make a loadable section is to mark the section as
> loadable in the first place. See the gas documentation for how to set
> the section flags when using the .section directive.
I'm not sure if this is applicable when the section is added with "objcopy
--add-section=image=vmlinux.gz", where vmlinux.gz is an elf file that has been
compressed with gzip. How does one add this file as a section to an existing
elf file (bootloader) as "loadable in the first place" ?
You don't. At the time that the executable has been created, the
program segments have been created. objcopy is not currently capable
of modifying the program segment information.
Other than teaching objcopy how to modify program segments, one
approach you can use is to include the vmlinux.gz file in the link
which creates the executable in the first place. Put it in the right
place with the linker script, and link against it using -b binary. I
believe that is what the i386 Linux kernel build procedure does.
Ian
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~1999-07-01 0:00 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-01 0:00 Using objdump to force a section to load with gdb Brendan Simon
1999-07-01 0:00 ` objdump or gdb to force a section to load ? Brendan Simon
1999-07-01 0:00 ` Jonathan Larmour
[not found] ` <376981EF.BE10D7C8@dgs.monash.edu.au>
[not found] ` <37699391.2CF83050@cygnus.co.uk>
1999-07-01 0:00 ` SOLVED: " Brendan Simon
1999-07-01 0:00 ` Ian Lance Taylor
1999-07-01 0:00 ` Using objdump to force a section to load with gdb Ian Lance Taylor
1999-07-01 0:00 ` Brendan Simon
1999-07-01 0:00 ` Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).