public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: IA64 gas is broken
@ 2005-02-14 11:02 Jan Beulich
  2005-02-15 12:18 ` James E Wilson
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2005-02-14 11:02 UTC (permalink / raw)
  To: hjl; +Cc: binutils

>>> "H. J. Lu" <hjl@lucon.org> 11.02.05 21:58:33 >>>
>On Fri, Feb 11, 2005 at 11:46:46AM -0800, H. J. Lu wrote:
>> [hjl@gnu-4 tmp]$ cat crti.s
>>         .xdata8
".init_array",@fptr(__pthread_initialize_minimal_internal)
>> [hjl@gnu-4 tmp]$ gcc -c crti.s
>> gcc: Internal error: Segmentation fault (program as)
>> Please submit a full bug report.
>> See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
>> 
>
>This obstack_free calls in patch
>
>http://sourceware.org/ml/binutils/2005-02/msg00029.html 
>
>is the cause. set_section uses the memory. I will back out the
following
>patch.

The memory isn't used, it's just that (once again) the use of an
obstack here is not ideal; two other allocations happen against the
notes obstack, due to the section symbol getting created. Note that I
didn't catch that because your source code again violates the
specification (and gas doesn't check/enforce this): .xdata is not
supposed to create new sections.

Additionally, there's more broken in the orginal code than it first
seems: parse_section_name parses the name (perhaps removing quotes), and
then obj_elf_section_name does so again; I guess we should rather pass
the original input to obj_elf_section (thus at once removing the memory
leak)...

The question thus is: Should the assembler continue to violate the spec
and allow .xdata to create sections (in which case the second change
would be at least desirable), or should it be fixed, in which case
probably calling obj_elf_change_section might not be necessary at all
anymore, thus allowing to free the allocated name string.

Jan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: IA64 gas is broken
  2005-02-14 11:02 IA64 gas is broken Jan Beulich
@ 2005-02-15 12:18 ` James E Wilson
  0 siblings, 0 replies; 4+ messages in thread
From: James E Wilson @ 2005-02-15 12:18 UTC (permalink / raw)
  To: Jan Beulich; +Cc: H. J. Lu, binutils

On Mon, 2005-02-14 at 00:36, Jan Beulich wrote:
> The question thus is: Should the assembler continue to violate the spec
> and allow .xdata to create sections (in which case the second change
> would be at least desirable), or should it be fixed, in which case
> probably calling obj_elf_change_section might not be necessary at all
> anymore, thus allowing to free the allocated name string.

HJ's example comes from glibc.  Since we are trying to avoid
unnecessarily breaking backwards compatibility, that means we can only
emit a warning here for now.  So we have to go with the former solution
for now, which means continuing to create sections while warning about
it, and adding a comment to indicate a possible future cleanup which
makes this an error and allows us to free the string.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: IA64 gas is broken
  2005-02-11 22:30 H. J. Lu
@ 2005-02-12  0:20 ` H. J. Lu
  0 siblings, 0 replies; 4+ messages in thread
From: H. J. Lu @ 2005-02-12  0:20 UTC (permalink / raw)
  To: jbeulich, wilson; +Cc: binutils

On Fri, Feb 11, 2005 at 11:46:46AM -0800, H. J. Lu wrote:
> [hjl@gnu-4 tmp]$ cat crti.s
>         .xdata8 ".init_array",@fptr(__pthread_initialize_minimal_internal)
> [hjl@gnu-4 tmp]$ gcc -c crti.s
> gcc: Internal error: Segmentation fault (program as)
> Please submit a full bug report.
> See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
> 

This obstack_free calls in patch

http://sourceware.org/ml/binutils/2005-02/msg00029.html

is the cause. set_section uses the memory. I will back out the following
patch.


H.J.
---
Index: config/tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -p -r1.129 -r1.130
--- config/tc-ia64.c	2 Feb 2005 07:37:33 -0000	1.129
+++ config/tc-ia64.c	11 Feb 2005 07:45:20 -0000	1.130
@@ -4704,6 +4713,7 @@ dot_xdata (size)
 
   md.keep_pending_output = 1;
   set_section (name);
+  obstack_free (&notes, name);
   cons (size);
   obj_elf_previous (0);
   md.keep_pending_output = 0;
@@ -4758,6 +4768,7 @@ dot_xfloat_cons (kind)
 
   md.keep_pending_output = 1;
   set_section (name);
+  obstack_free (&notes, name);
   stmt_float_cons (kind);
   obj_elf_previous (0);
   md.keep_pending_output = 0;
@@ -4773,6 +4784,7 @@ dot_xstringer (zero)
 
   md.keep_pending_output = 1;
   set_section (name);
+  obstack_free (&notes, name);
   stringer (zero);
   obj_elf_previous (0);
   md.keep_pending_output = 0;
@@ -4789,6 +4801,7 @@ dot_xdata_ua (size)
 
   md.keep_pending_output = 1;
   set_section (name);
+  obstack_free (&notes, name);
   md.auto_align = 0;
   cons (size);
   md.auto_align = saved_auto_align;
@@ -4807,6 +4820,7 @@ dot_xfloat_cons_ua (kind)
 
   md.keep_pending_output = 1;
   set_section (name);
+  obstack_free (&notes, name);
   md.auto_align = 0;
   stmt_float_cons (kind);
   md.auto_align = saved_auto_align;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* IA64 gas is broken
@ 2005-02-11 22:30 H. J. Lu
  2005-02-12  0:20 ` H. J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: H. J. Lu @ 2005-02-11 22:30 UTC (permalink / raw)
  To: jbeulich; +Cc: binutils

[hjl@gnu-4 tmp]$ cat crti.s
        .xdata8 ".init_array",@fptr(__pthread_initialize_minimal_internal)
[hjl@gnu-4 tmp]$ gcc -c crti.s
gcc: Internal error: Segmentation fault (program as)
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.


H.J.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-02-14 23:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-14 11:02 IA64 gas is broken Jan Beulich
2005-02-15 12:18 ` James E Wilson
  -- strict thread matches above, loose matches on Subject: below --
2005-02-11 22:30 H. J. Lu
2005-02-12  0:20 ` H. J. Lu

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).