This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] arc: prototype arc_get_mach in opcodes/arc.h


On Mon, Jun 27, 2016 at 11:22:21AM +0930, Alan Modra wrote:
> On Sun, Jun 26, 2016 at 06:21:59AM -0400, tbsaunde+binutils@tbsaunde.org wrote:
> > include/ChangeLog:
> > 
> > 2016-06-26  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
> > 
> > 	* opcode/arc.h (arc_get_mach): New prototype.
> 
> This also is probably better put in a new bfd/elf32-arc.h, since it
> really doesn't have anything to do with opcodes.
> 
> There are also mechanisms to put prototypes into libfd.h (see
> INTERNAL_DEFINITION) or more appropriately in this case for a public
> function, bfd.h (FUNCTION/SYNOPSIS).  I'm not a big fan of this scheme
> but if you wanted to use it to declare arc_get_mach rather than using
> a new header that would be OK too.  Same goes for the dlx patch.

ok, here's what I'm planning on committing.  It seems a little odd the
header is elf32-arc.h but the function is in cpu-arc.c, but I'm not sure
if that should be resolved by renaming the header or moving the function
or if it should stay this way.  There isn't yet any cpu-<cpu>.h so I
was hesitant to start adding one in case there is some reason not to I
don't know about.

Trev

commit dd30898dc6a578cbea5963ea39620a7bdfa6769c
Author: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
Date:   Fri Jun 3 21:21:23 2016 -0400

    arc: prototype arc_get_mach in a header
    
    gas/ChangeLog:
    
    2016-06-27  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
    
    	* config/tc-arc.c: Remove prototype of arc_get_mach.
    
    bfd/ChangeLog:
    
    2016-06-27  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
    
    	* elf32-arc.h: New file.
    	* cpu-arc.c: Adjust.

diff --git a/bfd/cpu-arc.c b/bfd/cpu-arc.c
index 07a052b..dff8358 100644
--- a/bfd/cpu-arc.c
+++ b/bfd/cpu-arc.c
@@ -22,6 +22,7 @@
 #include "sysdep.h"
 #include "bfd.h"
 #include "libbfd.h"
+#include "elf32-arc.h"
 
 #define ARC(mach, print_name, default_p, next) \
 {					\
@@ -57,10 +58,6 @@ const bfd_arch_info_type bfd_arc_arch =
 
 /* Utility routines.  */
 
-/* Given cpu type NAME, return its bfd_mach_arc_xxx value.
-   Returns -1 if not found.  */
-int arc_get_mach (char *name);
-
 int
 arc_get_mach (char *name)
 {
diff --git a/bfd/elf32-arc.h b/bfd/elf32-arc.h
new file mode 100644
index 0000000..2292439
--- /dev/null
+++ b/bfd/elf32-arc.h
@@ -0,0 +1,36 @@
+/* ARC-specific support for 32-bit ELF.
+   Copyright (C) 2016 Free Software Foundation, Inc.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#ifndef _ELF32_ARC_H
+#define _ELF32_ARC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Given cpu type NAME, return its bfd_mach_arc_xxx value.
+   Returns -1 if not found.  */
+int arc_get_mach (char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ELF32_ARC_H */
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 5755821..0024f6e 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -30,6 +30,7 @@
 #include "opcode/arc.h"
 #include "elf/arc.h"
 #include "../opcodes/arc-ext.h"
+#include "bfd/elf32-arc.h"
 
 /* Defines section.  */
 
@@ -134,8 +135,6 @@ static segT arcext_section;
 /* By default relaxation is disabled.  */
 static int relaxation_state = 0;
 
-extern int arc_get_mach (char *);
-
 /* Forward declarations.  */
 static void arc_lcomm (int);
 static void arc_option (int);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]