Bug 3006 - --sort-section name is brorken
Summary: --sort-section name is brorken
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.18
: P2 critical
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-07 16:53 UTC by H.J. Lu
Modified: 2006-08-08 16:09 UTC (History)
1 user (show)

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


Attachments
Check for a tree node with no section specified (313 bytes, patch)
2006-08-08 14:04 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2006-08-07 16:53:28 UTC
http://sourceware.org/ml/binutils/2006-07/msg00208.html

breaks --sort-section name:

[hjl@gnu-13 sort-1]$ cat x.c
void
foo ()
{
}
[hjl@gnu-13 sort-1]$ cat sort.t
SECTIONS
{
  .text           :
  {
    *(.text .text.*)
  }
  /DISCARD/ : { *(.*) }
}
[hjl@gnu-13 sort-1]$ gcc -c x.c
[hjl@gnu-13 sort-1]$ ./ld x.o --sort-section name -T sort.t
Segmentation fault
Comment 1 Nick Clifton 2006-08-08 14:04:00 UTC
Created attachment 1213 [details]
Check for a tree node with no section specified
Comment 2 Nick Clifton 2006-08-08 14:05:00 UTC
Hi H.J.

  I am probably wrong, but this looks like a simple case of a missing check for
a NULL pointer.  The uploaded patch for example allows your test case to link
successfully.  What do you think ?

Cheers
  Nick
Comment 3 H.J. Lu 2006-08-08 15:14:35 UTC
I think it is wrong. The problem is handler_data [1] is used for 2 things,
wildcard first. And then it was treated as tree later. I added 2 new tests
today. I think one of them may fail with your patch. I posted a patch at

http://sourceware.org/ml/binutils/2006-08/msg00080.html
Comment 4 Nick Clifton 2006-08-08 15:59:56 UTC
Subject: Re:  --sort-section name is brorken

Hi H.J.

> I think it is wrong. The problem is handler_data [1] is used for 2 things,
> wildcard first. And then it was treated as tree later. I added 2 new tests
> today. I think one of them may fail with your patch. I posted a patch at
> 
> http://sourceware.org/ml/binutils/2006-08/msg00080.html

Ah - right - please consider that patch approved.

Cheers
   Nick


Comment 5 H.J. Lu 2006-08-08 16:09:42 UTC
Fixed.