Does anybody have a sample linker script that keeps rodata?
I need to link a simple C file against my library and have the out format be binary.
Thanks, JL
Linker script rodata
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Linker script rodata
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Well, my kernel simply loads the binary into memory and jumps to it.
With this code and the Bare Bones script:
I get:
And thats it.
It should say 'fine'....Do you need any more info?
-JL
With this code and the Bare Bones script:
Code: Select all
char b[16];
b[0] = 'S';
b[1] = 'y';
b[2] = 'n';
b[3] = 'c';
b[4] = 'i';
b[5] = 'n';
b[6] = 'g';
b[7] = '\n';
b[8] = '\0';
kputs(b);
kputs("fine");
Code: Select all
Syncing
It should say 'fine'....Do you need any more info?
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Objdump your executable and make sure the data is really in there. Dissassemble the relevant source and make sure it is pointing to your rodata section.
The cake is a lie | rackbits.com
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Objdump output (when I compile it to an elf):
So it looks like it's there...Edit: Is the actual data there?
Heres a newer one:
Goes to
-JL
Code: Select all
Disassembly of section .rodata:
00101000 <_ebss-0x18>:
101000: 66 69 6e 65 00 2e imul $0x2e00,0x65(%esi),%bp
101006: 2e 2e 00 77 6f add %dh,%cs:0x6f(%edi)
10100b: 72 6b jb 101078 <_ebss+0x60>
10100d: 3f aas
10100e: 00 57 61 add %dl,0x61(%edi)
101011: 69 .byte 0x69
101012: 74 2e je 101042 <_ebss+0x2a>
101014: 2e cs
101015: 2e cs
...
Heres a newer one:
Code: Select all
char b[16];
b[0] = 'S';
b[1] = 'y';
b[2] = 'n';
b[3] = 'c';
b[4] = 'i';
b[5] = 'n';
b[6] = 'g';
b[7] = '\n';
b[8] = '\0';
kputs(b);
char c[16] = "Hello!\0";
kputs(c);
Code: Select all
Disassembly of section .rodata:
08048103 <.rodata>:
8048103: 48 dec %eax
8048104: 65 gs
8048105: 6c insb (%dx),%es:(%edi)
8048106: 6c insb (%dx),%es:(%edi)
8048107: 6f outsl %ds:(%esi),(%dx)
8048108: 21 00 and %eax,(%eax)
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io