This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: cr16-elf tools error: no .eh_frame_hdr table will be created.
- From: "M R Swami Reddy" <MR dot Swami dot Reddy at nsc dot com>
- To: "M R Swami Reddy" <MR dot Swami dot Reddy at nsc dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Fri, 17 Jul 2009 11:06:04 +0530
- Subject: Re: cr16-elf tools error: no .eh_frame_hdr table will be created.
- References: <20090701071125.GS3861@bubble.grove.modra.org> <4A4B0DF1.4070906@nsc.com> <20090701091421.GT3861@bubble.grove.modra.org> <4A4B2C00.3060801@nsc.com> <20090701094257.GU3861@bubble.grove.modra.org> <4A4B31D8.90709@nsc.com> <20090701115620.GV3861@bubble.grove.modra.org> <4A4B5715.4070002@nsc.com> <20090702003254.GW3861@bubble.grove.modra.org> <4A4DDC31.8060907@nsc.com> <20090704015312.GZ3861@bubble.grove.modra.org>
Hi Alan,
With below patch, GAS does resolve the relocs partially. But final linking
a.out relocs are not performed correctly, so .data section has incorrect
data/info.
Attached test case for describing the problem:
t12.s -> Test case
t12.dr -> Dump output with -Dr option with below (email) patch on t12.o
file.
t12.dr.old -> Dump output with -DR option without patch on t12.o file.
s.new -> Dump output with -s option for a.out (Fully linked)
s.old -> Dump output with -s option for a.out (Fully linked) With out
below patch.
Any idea who cause this type of problem. I guess, it could an issue with
R_CR16_NUM32 relocation type flags setting.
Thanks
Swami
Alan Modra wrote:
On Fri, Jul 03, 2009 at 03:53:45PM +0530, M R Swami Reddy wrote:
Btw, I think, no need to do or fix in TC_LINKER_RELAX_FIXUP here.
It looks like an issue with section flags setting or else.
No, if you make .eh_frame a non-allocated section, it won't be in
memory. How will the unwinder work without its unwinding info?
The following patch will cause non-code section fixups to be resolved
at assembly time, while code fixups will result in relocations that
the linker will be able to use for relaxation. Since the linker
doesn't even relax non-code sections (see elf32_cr16_relax_section)
there is no point in emitting extra relocs for sections like
.eh_frame. Applied.
* config/tc-cr16.h (TC_LINKRELAX_FIXUP): Set only for code sections.
Index: gas/config/tc-cr16.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-cr16.h,v
retrieving revision 1.3
diff -u -p -r1.3 tc-cr16.h
--- gas/config/tc-cr16.h 27 Nov 2008 11:57:29 -0000 1.3
+++ gas/config/tc-cr16.h 4 Jul 2009 01:32:57 -0000
@@ -1,5 +1,5 @@
/* tc-cr16.h -- Header file for tc-cr16.c, the CR16 GAS port.
- Copyright 2007 Free Software Foundation, Inc.
+ Copyright 2007, 2009 Free Software Foundation, Inc.
Contributed by M R Swami Reddy <MR.Swami.Reddy@nsc.com>
@@ -49,8 +49,9 @@ extern const struct relax_type md_relax_
#define TC_FORCE_RELOCATION(FIXP) cr16_force_relocation (FIXP)
extern int cr16_force_relocation (struct fix *);
-/* Fixup debug sections since we will never relax them. */
-#define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_ALLOC)
+/* Fixup non-code sections since we will never relax them. */
+#define TC_LINKRELAX_FIXUP(seg) \
+ ((seg->flags & (SEC_ALLOC | SEC_CODE)) == (SEC_ALLOC | SEC_CODE))
/* CR16 instructions, with operands included, are a multiple
of two bytes long. */
.file "t12.c"
.local _ebuf
.comm _ebuf,80,2
.globl __Stdin
.section .data
.align 4
.type __Stdin, @object
.size __Stdin, 72
__Stdin:
.short 1
.byte 0
.byte 0
.long __Stdin+68
.long __Stdin+69
.long __Stdin+68
.long __Stdin+68
.long __Stdin+68
.long __Stdin+68
.long __Stdin+36
.zero 40
.globl __Stdout
.align 4
.type __Stdout, @object
.size __Stdout, 72
__Stdout:
.short 2
.byte 1
.byte 1
.long __Stdout+68
.long __Stdout+69
.long __Stdout+68
.long __Stdout+68
.long __Stdout+68
.long __Stdout+68
.long __Stdout+36
.zero 40
.globl __Stderr
.align 4
.type __Stderr, @object
.size __Stderr, 72
__Stderr:
.short 2050
.byte 2
.byte 2
.long _ebuf
.long _ebuf+80
.long _ebuf
.long _ebuf
.long _ebuf
.long __Stderr+68
.long __Stderr+36
.zero 40
.globl __Files
.align 4
.type __Files, @object
.size __Files, 80
__Files:
.long __Stdin
.long __Stdout
.long __Stderr
.zero 68
.ident "GCC: (GNU) 4.1.2"
t12.o: file format elf32-cr16
Disassembly of section .data:
00000000 <__Stdin>:
0: 01 00 illegal
...
4: R_CR16_NUM32 __Stdin+0x44
8: R_CR16_NUM32 __Stdin+0x45
c: R_CR16_NUM32 __Stdin+0x44
10: R_CR16_NUM32 __Stdin+0x44
14: R_CR16_NUM32 __Stdin+0x44
18: R_CR16_NUM32 __Stdin+0x44
1c: R_CR16_NUM32 __Stdin+0x24
00000048 <__Stdout>:
48: 02 00 illegal
4a: 01 01 push $0x1,r1
...
4c: R_CR16_NUM32 __Stdout+0x44
50: R_CR16_NUM32 __Stdout+0x45
54: R_CR16_NUM32 __Stdout+0x44
58: R_CR16_NUM32 __Stdout+0x44
5c: R_CR16_NUM32 __Stdout+0x44
60: R_CR16_NUM32 __Stdout+0x44
64: R_CR16_NUM32 __Stdout+0x24
00000090 <__Stderr>:
90: 02 08 seq r2
92: 02 02 pop $0x1,r2
...
94: R_CR16_NUM32 _ebuf
98: R_CR16_NUM32 _ebuf+0x50
9c: R_CR16_NUM32 _ebuf
a0: R_CR16_NUM32 _ebuf
a4: R_CR16_NUM32 _ebuf
a8: R_CR16_NUM32 __Stderr+0x44
ac: R_CR16_NUM32 __Stderr+0x24
000000d8 <__Files>:
...
d8: R_CR16_NUM32 __Stdin
dc: R_CR16_NUM32 __Stdout
e0: R_CR16_NUM32 __Stderr
Disassembly of section .bss:
00000000 <_ebuf>:
...
Disassembly of section .comment:
00000000 <.comment>:
0: 00 47 lshd r0,(r1,r0)
2: 43 43 ashuw $-12:s,r3
4: 3a 20 andb $0x3:s,r10
6: 28 47 lshd r2,(r9,r8)
8: 4e 55 movd (r5,r4),(ra)
a: 29 20 andb $0x2:s,r9
c: 34 2e adduw $0x3:s,r4
e: 31 2e adduw $0x3:s,r1
10: 32 00 00 00 subd $0x0:l,(r3,r2)
14: 00 00
t12.o: file format elf32-cr16
Disassembly of section .data:
00000000 <__Stdin>:
0: 01 00 illegal
...
4: R_CR16_NUM32 __Stdin+0x44
8: R_CR16_NUM32 __Stdin+0x45
c: R_CR16_NUM32 __Stdin+0x44
10: R_CR16_NUM32 __Stdin+0x44
14: R_CR16_NUM32 __Stdin+0x44
18: R_CR16_NUM32 __Stdin+0x44
1c: R_CR16_NUM32 __Stdin+0x24
00000048 <__Stdout>:
48: 02 00 illegal
4a: 01 01 push $0x1,r1
...
4c: R_CR16_NUM32 __Stdout+0x44
50: R_CR16_NUM32 __Stdout+0x45
54: R_CR16_NUM32 __Stdout+0x44
58: R_CR16_NUM32 __Stdout+0x44
5c: R_CR16_NUM32 __Stdout+0x44
60: R_CR16_NUM32 __Stdout+0x44
64: R_CR16_NUM32 __Stdout+0x24
00000090 <__Stderr>:
90: 02 08 seq r2
92: 02 02 pop $0x1,r2
...
94: R_CR16_NUM32 _ebuf
98: R_CR16_NUM32 _ebuf+0x50
9c: R_CR16_NUM32 _ebuf
a0: R_CR16_NUM32 _ebuf
a4: R_CR16_NUM32 _ebuf
a8: R_CR16_NUM32 __Stderr+0x44
ac: R_CR16_NUM32 __Stderr+0x24
000000d8 <__Files>:
...
d8: R_CR16_NUM32 __Stdin
dc: R_CR16_NUM32 __Stdout
e0: R_CR16_NUM32 __Stderr
Disassembly of section .bss:
00000000 <_ebuf>:
...
Disassembly of section .comment:
00000000 <.comment>:
0: 00 47 lshd r0,(r1,r0)
2: 43 43 ashuw $-12:s,r3
4: 3a 20 andb $0x3:s,r10
6: 28 47 lshd r2,(r9,r8)
8: 4e 55 movd (r5,r4),(ra)
a: 29 20 andb $0x2:s,r9
c: 34 2e adduw $0x3:s,r4
e: 31 2e adduw $0x3:s,r1
10: 32 00 00 00 subd $0x0:l,(r3,r2)
14: 00 00
a.out: file format elf32-cr16
Contents of section .init:
0002 1e0100c0 480000c0 68001e03 ....H...h...
Contents of section .fini:
000e 1e0100c0 0c001e03 ........
Contents of section .jcr:
0018 00000000 ....
Contents of section .text:
001c 1e011200 04703001 00500710 ef104060 .....p0..P....@`
002c 130004b0 0400d200 120004b0 040020a0 .............. .
003c 0256161f 12001430 30011e03 1e011e03 .V.....00.......
004c 1e011200 00b01800 00560910 70000000 .........V..p...
005c 00000056 04102005 1800d000 1e031e01 ...V.. .........
006c 1e030000 1e011701 70059800 120000b0 ........p.......
007c 98009056 0710d000 b760fcff 07a09056 ...V.....`.....V
008c 1b1f1702 1e031e01 1e03 ..........
Contents of section .ctor:
0098 ffffffff 00000000 ........
Contents of section .dtor:
00a0 ffffffff 00000000 ........
Contents of section .data:
400000 00000000 a4000000 01000000 4c004000 ............L.@.
400010 4d004000 4c004000 4c004000 4c004000 M.@.L.@.L.@.L.@.
400020 4c004000 2c004000 00000000 00000000 L.@.,.@.........
400030 00000000 00000000 00000000 00000000 ................
400040 00000000 00000000 00000000 00000000 ................
400050 02000101 94004000 95004000 94004000 ......@...@...@.
400060 94004000 94004000 94004000 74004000 ..@...@...@.t.@.
400070 00000000 00000000 00000000 00000000 ................
400080 00000000 00000000 00000000 00000000 ................
400090 00000000 00000000 02080202 32014000 ............2.@.
4000a0 82014000 32014000 32014000 32014000 ..@.2.@.2.@.2.@.
4000b0 dc004000 bc004000 00000000 00000000 ..@...@.........
4000c0 00000000 00000000 00000000 00000000 ................
4000d0 00000000 00000000 00000000 00000000 ................
4000e0 08004000 50004000 98004000 00000000 ..@.P.@...@.....
4000f0 00000000 00000000 00000000 00000000 ................
400100 00000000 00000000 00000000 00000000 ................
400110 00000000 00000000 00000000 00000000 ................
400120 00000000 00000000 00000000 00000000 ................
Contents of section .comment:
0000 00474e55 20432063 7274692e 6f000047 .GNU C crti.o..G
0010 43433a20 28474e55 2920342e 312e3200 CC: (GNU) 4.1.2.
0020 00474343 3a202847 4e552920 342e312e .GCC: (GNU) 4.1.
0030 32000047 43433a20 28474e55 2920342e 2..GCC: (GNU) 4.
0040 312e3200 00474e55 20432063 72746e2e 1.2..GNU C crtn.
0050 6f00 o.
a.out: file format elf32-cr16
Contents of section .init:
0002 1e0100c0 480000c0 68001e03 ....H...h...
Contents of section .fini:
000e 1e0100c0 0c001e03 ........
Contents of section .jcr:
0018 00000000 ....
Contents of section .text:
001c 1e011200 04703001 00500710 ef104060 .....p0..P....@`
002c 130004b0 0400d200 120004b0 040020a0 .............. .
003c 0256161f 12001430 30011e03 1e011e03 .V.....00.......
004c 1e011200 00b01800 00560910 70000000 .........V..p...
005c 00000056 04102005 1800d000 1e031e01 ...V.. .........
006c 1e030000 1e011701 70059800 120000b0 ........p.......
007c 98009056 0710d000 b760fcff 07a09056 ...V.....`.....V
008c 1b1f1702 1e031e01 1e03 ..........
Contents of section .ctor:
0098 ffffffff 00000000 ........
Contents of section .dtor:
00a0 ffffffff 00000000 ........
Contents of section .data:
400000 00000000 9c00c0ff 01000000 fcffffff ................
400010 f8ffffff f4ffffff f0ffffff ecffffff ................
400020 e8ffffff e4ffffff 00000000 00000000 ................
400030 00000000 00000000 00000000 00000000 ................
400040 00000000 00000000 00000000 00000000 ................
400050 02000101 fcffffff f8ffffff f4ffffff ................
400060 f0ffffff ecffffff e8ffffff e4ffffff ................
400070 00000000 00000000 00000000 00000000 ................
400080 00000000 00000000 00000000 00000000 ................
400090 00000000 00000000 02080202 96000000 ................
4000a0 92000000 8e000000 8a000000 86000000 ................
4000b0 e8ffffff e4ffffff 00000000 00000000 ................
4000c0 00000000 00000000 00000000 00000000 ................
4000d0 00000000 00000000 00000000 00000000 ................
4000e0 28ffffff 6cffffff b0ffffff 00000000 (...l...........
4000f0 00000000 00000000 00000000 00000000 ................
400100 00000000 00000000 00000000 00000000 ................
400110 00000000 00000000 00000000 00000000 ................
400120 00000000 00000000 00000000 00000000 ................
Contents of section .comment:
0000 00474e55 20432063 7274692e 6f000047 .GNU C crti.o..G
0010 43433a20 28474e55 2920342e 312e3200 CC: (GNU) 4.1.2.
0020 00474343 3a202847 4e552920 342e312e .GCC: (GNU) 4.1.
0030 32000047 43433a20 28474e55 2920342e 2..GCC: (GNU) 4.
0040 312e3200 00474e55 20432063 72746e2e 1.2..GNU C crtn.
0050 6f00 o.