Bug 9766 - "--kill-at" results in wrong export names
Summary: "--kill-at" results in wrong export names
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-20 13:46 UTC by Christoph von Wittich
Modified: 2009-01-26 15:53 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Use strrchr and check for a following digit. (286 bytes, patch)
2009-01-21 12:01 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph von Wittich 2009-01-20 13:46:37 UTC
"Function@2@4" will result in "Function" instead of "Function@2" when --kill-at
is used

I only had a quick look at the sources - when I see this correct strchr in
dlltoold.c/xlate should be changed to strrchr.
Comment 1 Christoph von Wittich 2009-01-20 15:52:42 UTC
(In reply to comment #0)
> "Function@2@4" will result in "Function" instead of "Function@2" when --kill-at
> is used
> 
> I only had a quick look at the sources - when I see this correct strchr in
> dlltoold.c/xlate should be changed to strrchr.

Should be "Function@4@4" - and yes, changing the strchr to strrchr results in
correct exports.
Comment 2 Christoph von Wittich 2009-01-20 17:06:09 UTC
it should check if a number follows as well otherwise functions names like
"??2@YAPAXI@Z" would be destroyed as well (like the ones in msvcrt.dll)
Comment 3 Nick Clifton 2009-01-21 12:01:59 UTC
Created attachment 3677 [details]
Use strrchr and check for a following digit.
Comment 4 Nick Clifton 2009-01-21 12:02:30 UTC
Hi Christoph,

  Please could you try out the uploaded patch and let me know if it works for you.

Cheers
  Nick
Comment 5 Christoph von Wittich 2009-01-23 14:19:06 UTC
the patch works fine
Comment 6 Colin Finck 2009-01-23 14:28:05 UTC
I've tested the patch as well and it fixes a bug for us in ReactOS.
So, would be great if someone could commit that to upstream binutils :-)
Comment 7 Sourceware Commits 2009-01-26 15:53:07 UTC
Subject: Bug 9766

CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2009-01-26 15:52:55

Modified files:
	binutils       : ChangeLog dlltool.c 

Log message:
	PR 9766
	* dlltool.c (xlate): When strip text after the @ sign, look for
	the last one not the first one.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1413&r2=1.1414
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/dlltool.c.diff?cvsroot=src&r1=1.90&r2=1.91

Comment 8 Nick Clifton 2009-01-26 15:53:39 UTC
Hi Christoph,

  I have checked the patch in along with this changelog entry.

Cheers
  Nick

binutils/ChangeLog
2009-01-26  Nick Clifton  <nickc@redhat.com>

	PR 9766
	* dlltool.c (xlate): When strip text after the @ sign, look for
	the last one not the first one.