krfkeith / sx-gcc

Automatically exported from code.google.com/p/sx-gcc
0 stars 0 forks source link

__centry/__fentry are added when do partial linking (ld) #144

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It turned out that the global symbols __centry/__fentry are also added when
linking partial(ld -r ) only. This leads to a multiple definition error at
the final linking step.

There is a small example attached. It wraps the open system call.
Compile it with the do_compile scripts.

I did tests on SX with native and GNU compiler/linkers and a test on Linux.
On Linux I do not see these symbols at all. So must be SX specific then.

On SX I see after the ld -r wrap step the mentioned symbols in the object
which should probably not appear there. As I said SX native and GNU bring
the multiple definition error at the final linking step.

hwwnec4@ontake:/nfs/nas/scr/ws/hwwnec4-gasnet-0/tests> ./do_compile 
sxld: absolute symbol __centry in teststrip.o multiply defined
sxcc: /SX/usr/bin/sxld is terminated with status 1

hwwnec4@ontake:/nfs/nas/scr/ws/hwwnec4-gasnet-0/tests> ./do_compile_gnu 
teststrip.o:teststrip.c:(*ABS*+0x798): multiple definition of `__centry'
collect2: ld returned 1 exit status

Could you please fix that?

In the IOFWD we fixed this problem by stripping theses symbols from the
objects until now. But it looks like that the strip doesn't work if the
object file is compiled with -C hopt (high optimization) which is bad for
the users of course.

Do you now how __centry/__fentry are used? I saw them when you check in
something related. Othwerwise I can gather more information if you want.

Original issue reported on code.google.com by danny.st...@gmail.com on 11 Nov 2009 at 10:32

Attachments:

GoogleCodeExporter commented 9 years ago
I know about __?entry symbol semantics on SX - partial linking probably uses a
separate default linker script, so just removing them from there should do the 
trick.
will cater to this asap ...

Original comment by jmoc...@gmail.com on 11 Nov 2009 at 10:36

GoogleCodeExporter commented 9 years ago
svn up, danny, and try r215: __?entry symbols should be omitted when linking 
with -r
(do test if decent fully linked executables are still created by gnu ld, too;))

Original comment by jmoc...@gmail.com on 11 Nov 2009 at 11:31

GoogleCodeExporter commented 9 years ago
Thanks for the quick response and fix! It works now including fully linking.

Original comment by danny.st...@gmail.com on 11 Nov 2009 at 12:14