* Problems converting elf32-sh to coff-sh
@ 1999-09-10 14:42 François Costin
1999-09-10 16:57 ` Ian Lance Taylor
0 siblings, 1 reply; 2+ messages in thread
From: François Costin @ 1999-09-10 14:42 UTC (permalink / raw)
To: binutils
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]
I need for some reason to convert simple elf object files into coff files.
My compiler produces some R_SH_DIR32 relocations which are not supported by
the binutils for the conversion. I know you can't do it in the general
case, but I've managed somehow to remap the R_SH_DIR32 as a R_SH_IMM32
reloc. This part seems to work fine.
Only one exception... when an object file contains a reloc to a function
inside that same object file, the converter adds a weird negative offset to
the symbol name when I ask for an objdump -x.
I did find where the offset comes from there's a line in the coff-sh.c file
inside the CALC_ADDEND macro which goes like this:
cache_ptr->addend = -(ptr->section->vma + ptr->value);
I did try to simply change this to:
cache_ptr->addend = 0;
Now, after doing an objcopy -O coff-sh, when I do an objdump -x with the new
code, I do not see the offset. But when I do the objdump with an older
version of the code, it does see it. And it fact it stays there.
I'd just like to know where in the code I can once and for all delete that
offset. It is only for that specific application and I know that if I can
delete the offset, I'll have no problems anymore converting my object files.
I hope I made myself clear. I can give more details if needed!
François Costin
Electrical Engineering
Technologies Lyre Inc.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Problems converting elf32-sh to coff-sh
1999-09-10 14:42 Problems converting elf32-sh to coff-sh François Costin
@ 1999-09-10 16:57 ` Ian Lance Taylor
0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 1999-09-10 16:57 UTC (permalink / raw)
To: costin00; +Cc: binutils
From: =?iso-8859-1?Q?Fran=E7ois_Costin?= <costin00@gel.ulaval.ca>
Date: Fri, 10 Sep 1999 17:44:19 -0400
I need for some reason to convert simple elf object files into coff files.
My compiler produces some R_SH_DIR32 relocations which are not supported by
the binutils for the conversion. I know you can't do it in the general
case, but I've managed somehow to remap the R_SH_DIR32 as a R_SH_IMM32
reloc. This part seems to work fine.
Only one exception... when an object file contains a reloc to a function
inside that same object file, the converter adds a weird negative offset to
the symbol name when I ask for an objdump -x.
I did find where the offset comes from there's a line in the coff-sh.c file
inside the CALC_ADDEND macro which goes like this:
cache_ptr->addend = -(ptr->section->vma + ptr->value);
I did try to simply change this to:
cache_ptr->addend = 0;
Now, after doing an objcopy -O coff-sh, when I do an objdump -x with the new
code, I do not see the offset. But when I do the objdump with an older
version of the code, it does see it. And it fact it stays there.
I'd just like to know where in the code I can once and for all delete that
offset. It is only for that specific application and I know that if I can
delete the offset, I'll have no problems anymore converting my object files.
You've already figured out how to delete that offset: change the
CALC_ADDEND macro.
I don't understand what else you are asking for. For coff-sh, the
addend computed by CALC_ADDEND and reported by objdump -x doesn't
reflect any value that actually appears in the object file. It is a
value computed solely to make the link work correctly.
Try generating a COFF file directly using the assembler, and see what
you get. You want to get the same results after the conversion from
ELF.
Ian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-09-10 16:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-10 14:42 Problems converting elf32-sh to coff-sh François Costin
1999-09-10 16:57 ` 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).