This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cr16-elf tools error: no .eh_frame_hdr table will be created.


Hi,
It looks like an issue with GAS generating the object file.
--Testcase: test.s:
==
      .file   "t12.c"
       .globl  __Stdin
       .section        .data
       .type   __Stdin, @object
       .size   __Stdin, 72
       .long   0
__Stdin:
       .short  1
       .byte   0
       .byte   0
       .long   __Stdin+0x44
       .zero   40
       .ident  "GCC: (GNU) 4.1.2"
====
Command line:
> cr16-elf-as test.s -o test.o
> cr16-elf-objdump -Dr test.o
==
..
Disassembly of section .data:
00000000 <__Stdin-0x4>:
  0:   00 00           illegal
       ...

00000004 <__Stdin>:
4: 01 00 illegal
6: 00 00 illegal
8: 48 00 00 00 andd $0x0:l,(r9,r8) // ERROR: it should 44 00 00 00
c: 00 00
8: R_CR16_NUM32 __Stdin
...
====


Instead of including the 0x44, gas include "0x44 + _Stdin". Is this expected?

Any inputs are appreciated.

Thanks
Swami

M R Swami Reddy wrote:
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. */






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]