aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-09-19 12:15:16 +0930
committerAlan Modra <amodra@gmail.com>2019-09-20 18:04:02 +0930
commitaf30dc128be191dc6179763203035ff62c634284 (patch)
tree6d6f843bbfa3b1ae57bd6c2913b347b429a1ff3f
parent00f93c449228e69f2161405b1f49b406e88785f0 (diff)
downloadgdb-af30dc128be191dc6179763203035ff62c634284.zip
gdb-af30dc128be191dc6179763203035ff62c634284.tar.gz
gdb-af30dc128be191dc6179763203035ff62c634284.tar.bz2
bfd macro conversion to inline functions, asymbol
* bfd-in.h (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name), (bfd_asymbol_bfd, bfd_asymbol_flavour, bfd_set_asymbol_name): Delete. * bfd.c (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name), (bfd_asymbol_bfd, bfd_set_asymbol_name): New inline functions. * targets.c (bfd_asymbol_flavour): Likewise. * bfd-in2.h: Regenerate.
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/bfd-in.h13
-rw-r--r--bfd/bfd-in2.h51
-rw-r--r--bfd/bfd.c30
-rw-r--r--bfd/targets.c8
5 files changed, 85 insertions, 26 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1c700db..5222063 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,14 @@
2019-09-20 Alan Modra <amodra@gmail.com>
+ * bfd-in.h (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
+ (bfd_asymbol_bfd, bfd_asymbol_flavour, bfd_set_asymbol_name): Delete.
+ * bfd.c (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
+ (bfd_asymbol_bfd, bfd_set_asymbol_name): New inline functions.
+ * targets.c (bfd_asymbol_flavour): Likewise.
+ * bfd-in2.h: Regenerate.
+
+2019-09-20 Alan Modra <amodra@gmail.com>
+
* archive.c (bfd_generic_archive_p): Use bfd_set_thin_archive.
* bfd-in.h (bfd_get_filename, bfd_get_cacheable, bfd_get_format),
(bfd_get_target, bfd_get_flavour, bfd_family_coff, bfd_big_endian),
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 34c1c3a..e9ada8d 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -237,19 +237,6 @@ typedef unsigned long symindex;
#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
-/* General purpose part of a symbol X;
- target specific parts are in libcoff.h, libaout.h, etc. */
-
-#define bfd_asymbol_section(sy) ((sy)->section)
-#define bfd_asymbol_value(sy) ((sy)->section->vma + (sy)->value)
-#define bfd_asymbol_name(sy) ((sy)->name)
-#define bfd_asymbol_bfd(sy) ((sy)->the_bfd)
-#define bfd_asymbol_flavour(sy) \
- (((sy)->flags & BSF_SYNTHETIC) != 0 \
- ? bfd_target_unknown_flavour \
- : (sy)->the_bfd->xvec->flavour)
-#define bfd_set_asymbol_name(sy, n) do { (sy)->name = (n); } while (0)
-
/* A canonical archive symbol. */
/* This is a type pun with struct ranlib on purpose! */
typedef struct carsym
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 4f15867..5ac3f41 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -244,19 +244,6 @@ typedef unsigned long symindex;
#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
-/* General purpose part of a symbol X;
- target specific parts are in libcoff.h, libaout.h, etc. */
-
-#define bfd_asymbol_section(sy) ((sy)->section)
-#define bfd_asymbol_value(sy) ((sy)->section->vma + (sy)->value)
-#define bfd_asymbol_name(sy) ((sy)->name)
-#define bfd_asymbol_bfd(sy) ((sy)->the_bfd)
-#define bfd_asymbol_flavour(sy) \
- (((sy)->flags & BSF_SYNTHETIC) != 0 \
- ? bfd_target_unknown_flavour \
- : (sy)->the_bfd->xvec->flavour)
-#define bfd_set_asymbol_name(sy, n) do { (sy)->name = (n); } while (0)
-
/* A canonical archive symbol. */
/* This is a type pun with struct ranlib on purpose! */
typedef struct carsym
@@ -7381,6 +7368,36 @@ bfd_set_usrdata (bfd *abfd, void *val)
abfd->usrdata = val;
}
+static inline asection *
+bfd_asymbol_section (const asymbol *sy)
+{
+ return sy->section;
+}
+
+static inline bfd_vma
+bfd_asymbol_value (const asymbol *sy)
+{
+ return sy->section->vma + sy->value;
+}
+
+static inline const char *
+bfd_asymbol_name (const asymbol *sy)
+{
+ return sy->name;
+}
+
+static inline struct bfd *
+bfd_asymbol_bfd (const asymbol *sy)
+{
+ return sy->the_bfd;
+}
+
+static inline void
+bfd_set_asymbol_name (asymbol *sy, const char *name)
+{
+ sy->name = name;
+}
+
typedef enum bfd_error
{
@@ -8135,6 +8152,14 @@ bfd_get_symbol_leading_char (const bfd *abfd)
return abfd->xvec->symbol_leading_char;
}
+static inline enum bfd_flavour
+bfd_asymbol_flavour (const asymbol *sy)
+{
+ if ((sy->flags & BSF_SYNTHETIC) != 0)
+ return bfd_target_unknown_flavour;
+ return sy->the_bfd->xvec->flavour;
+}
+
bfd_boolean bfd_set_default_target (const char *name);
const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
diff --git a/bfd/bfd.c b/bfd/bfd.c
index c11274c..9270e11 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -447,6 +447,36 @@ CODE_FRAGMENT
. abfd->usrdata = val;
.}
.
+.static inline asection *
+.bfd_asymbol_section (const asymbol *sy)
+.{
+. return sy->section;
+.}
+.
+.static inline bfd_vma
+.bfd_asymbol_value (const asymbol *sy)
+.{
+. return sy->section->vma + sy->value;
+.}
+.
+.static inline const char *
+.bfd_asymbol_name (const asymbol *sy)
+.{
+. return sy->name;
+.}
+.
+.static inline struct bfd *
+.bfd_asymbol_bfd (const asymbol *sy)
+.{
+. return sy->the_bfd;
+.}
+.
+.static inline void
+.bfd_set_asymbol_name (asymbol *sy, const char *name)
+.{
+. sy->name = name;
+.}
+.
*/
#include "sysdep.h"
diff --git a/bfd/targets.c b/bfd/targets.c
index 116a5c3..717657f 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -644,6 +644,14 @@ to find an alternative output format that is suitable.
. return abfd->xvec->symbol_leading_char;
.}
.
+.static inline enum bfd_flavour
+.bfd_asymbol_flavour (const asymbol *sy)
+.{
+. if ((sy->flags & BSF_SYNTHETIC) != 0)
+. return bfd_target_unknown_flavour;
+. return sy->the_bfd->xvec->flavour;
+.}
+.
*/
/* All known xvecs (even those that don't compile on all systems).