public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Patch/gas]: Check basename declaration for IVMS cross assembler
@ 2009-09-03  8:47 Tristan Gingold
  2009-09-03 12:11 ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: Tristan Gingold @ 2009-09-03  8:47 UTC (permalink / raw)
  To: Binutils

Hi,

when configured for itanium VMS, tc-ia64.c calls basename().  But  
libiberty.h requires to check for its
declaration.  This patch add the check in gas configure.in

Checked on Darwin host and ia64-openvms target.

Ok to commit ?

Tristan.

2009-09-03  Tristan Gingold  <gingold@adacore.com>

	* configure.in: Check for basename declaration.
	* config.in: Regenerate.
	* configure: Regenerate.

Index: configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.213
diff -c -r1.213 configure.in
*** configure.in	6 Aug 2009 17:38:02 -0000	1.213
--- configure.in	3 Sep 2009 08:42:35 -0000
***************
*** 693,699 ****
   GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
   GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)

! AC_CHECK_DECLS([vsnprintf])

   BFD_BINARY_FOPEN

--- 693,699 ----
   GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
   GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)

! AC_CHECK_DECLS([vsnprintf, basename])

   BFD_BINARY_FOPEN


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

* Re: [Patch/gas]: Check basename declaration for IVMS cross  assembler
  2009-09-03  8:47 [Patch/gas]: Check basename declaration for IVMS cross assembler Tristan Gingold
@ 2009-09-03 12:11 ` Alan Modra
  2009-09-03 12:57   ` Tristan Gingold
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra @ 2009-09-03 12:11 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: Binutils

On Thu, Sep 03, 2009 at 10:47:28AM +0200, Tristan Gingold wrote:
> when configured for itanium VMS, tc-ia64.c calls basename().  But  
> libiberty.h requires to check for its
> declaration.  This patch add the check in gas configure.in

Instead, please use lbasename in tc-ia64.c.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [Patch/gas]: Check basename declaration for IVMS cross assembler
  2009-09-03 12:11 ` Alan Modra
@ 2009-09-03 12:57   ` Tristan Gingold
  2009-09-03 13:18     ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: Tristan Gingold @ 2009-09-03 12:57 UTC (permalink / raw)
  To: Alan Modra; +Cc: Binutils


On Sep 3, 2009, at 2:11 PM, Alan Modra wrote:

> On Thu, Sep 03, 2009 at 10:47:28AM +0200, Tristan Gingold wrote:
>> when configured for itanium VMS, tc-ia64.c calls basename().  But
>> libiberty.h requires to check for its
>> declaration.  This patch add the check in gas configure.in
>
> Instead, please use lbasename in tc-ia64.c.

Ah, thanks.
Is this patch OK ?  (I have also remarked that the buffer wasn't freed).

Tristan.

gas/
2009-09-03  Tristan Gingold  <gingold@adacore.com>

	* config/tc-ia64.c (ia64_vms_note): Use lbasename instead of basename.
	Call xstrdup on the result and free the buffer after use.

Index: config/tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.208
diff -c -r1.208 tc-ia64.c
*** config/tc-ia64.c	29 Aug 2009 22:10:59 -0000	1.208
--- config/tc-ia64.c	3 Sep 2009 12:55:20 -0000
***************
*** 11667,11673 ****
     subsegT subseg = now_subseg;
     Elf_Internal_Note i_note;
     asection *secp = NULL;
!   char *basec, *bname;
     char buf [256];
     symbolS *sym;

--- 11667,11673 ----
     subsegT subseg = now_subseg;
     Elf_Internal_Note i_note;
     asection *secp = NULL;
!   char *bname;
     char buf [256];
     symbolS *sym;

***************
*** 11679,11686 ****
   			 SEC_HAS_CONTENTS | SEC_READONLY);
!   basec = xstrdup (out_file_name);
!   bname = basename (basec);
     if ((p = strrchr (bname, '.')))
       *p = '\0';

--- 11679,11685 ----
   			 SEC_HAS_CONTENTS | SEC_READONLY);

     /* Module header note.  */
!   bname = xstrdup (lbasename (out_file_name));
     if ((p = strrchr (bname, '.')))
       *p = '\0';

***************
*** 11709,11714 ****
--- 11708,11714 ----

     p = frag_more (strlen (bname) + 1);
     strcpy (p, bname);
+   free (bname);

     p = frag_more (5);
     strcpy (p, "V1.0");

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

* Re: [Patch/gas]: Check basename declaration for IVMS cross  assembler
  2009-09-03 12:57   ` Tristan Gingold
@ 2009-09-03 13:18     ` Alan Modra
  2009-09-03 13:21       ` Tristan Gingold
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra @ 2009-09-03 13:18 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: Binutils

On Thu, Sep 03, 2009 at 02:57:47PM +0200, Tristan Gingold wrote:
> 	* config/tc-ia64.c (ia64_vms_note): Use lbasename instead of basename.
> 	Call xstrdup on the result and free the buffer after use.

Thanks, this is fine.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [Patch/gas]: Check basename declaration for IVMS cross  assembler
  2009-09-03 13:18     ` Alan Modra
@ 2009-09-03 13:21       ` Tristan Gingold
  0 siblings, 0 replies; 5+ messages in thread
From: Tristan Gingold @ 2009-09-03 13:21 UTC (permalink / raw)
  To: Alan Modra; +Cc: Binutils


On Sep 3, 2009, at 3:18 PM, Alan Modra wrote:

> On Thu, Sep 03, 2009 at 02:57:47PM +0200, Tristan Gingold wrote:
>> 	* config/tc-ia64.c (ia64_vms_note): Use lbasename instead of  
>> basename.
>> 	Call xstrdup on the result and free the buffer after use.
>
> Thanks, this is fine.

Thanks, committed.

Tristan.

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

end of thread, other threads:[~2009-09-03 13:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-03  8:47 [Patch/gas]: Check basename declaration for IVMS cross assembler Tristan Gingold
2009-09-03 12:11 ` Alan Modra
2009-09-03 12:57   ` Tristan Gingold
2009-09-03 13:18     ` Alan Modra
2009-09-03 13:21       ` Tristan Gingold

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