* [PATCH 0/2]: bfd: cleanups for the generic a.out support
@ 2020-05-26 16:13 Gunther Nikl
2020-05-26 16:14 ` [PATCH 1/2]: bfd: remove unused NO_WRITE_HEADER_KLUDGE #define Gunther Nikl
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Gunther Nikl @ 2020-05-26 16:13 UTC (permalink / raw)
To: binutils
Hello!
This patch set for the generic BFD a.out backend removes a dead #define
and makes aoutx.h self-contained:
[PATCH 1/2]: bfd: remove unused NO_WRITE_HEADER_KLUDGE #define
[PATCH 2/2]: bfd: make aoutx.h self-contained
Regards
Gunther
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2]: bfd: remove unused NO_WRITE_HEADER_KLUDGE #define
2020-05-26 16:13 [PATCH 0/2]: bfd: cleanups for the generic a.out support Gunther Nikl
@ 2020-05-26 16:14 ` Gunther Nikl
2020-05-26 16:16 ` [PATCH 2/2]: bfd: make aoutx.h self-contained Gunther Nikl
2020-05-29 3:07 ` [PATCH 0/2]: bfd: cleanups for the generic a.out support Alan Modra
2 siblings, 0 replies; 6+ messages in thread
From: Gunther Nikl @ 2020-05-26 16:14 UTC (permalink / raw)
To: binutils
NO_WRITE_HEADER_KLUDGE is defined but nowhere used. It seems that this
define is dead for a very long time. I was unable to find a binutils
version using this define.
2020-05-XX Gunther Nikl <gnikl@justmail.de>
* i386aout.c (NO_WRITE_HEADER_KLUDGE): Delete define.
* libaout.h (NO_WRITE_HEADER_KLUDGE): Do not define.
diff --git a/bfd/i386aout.c b/bfd/i386aout.c
index 694301b5bb..61e0306f8d 100644
--- a/bfd/i386aout.c
+++ b/bfd/i386aout.c
@@ -38,7 +38,6 @@
the tokens. */
#define MY(OP) CONCAT2 (i386_aout_,OP)
#define TARGETNAME "a.out-i386"
-#define NO_WRITE_HEADER_KLUDGE 1
#include "sysdep.h"
#include "bfd.h"
diff --git a/bfd/libaout.h b/bfd/libaout.h
index 61746db243..8e62072741 100644
--- a/bfd/libaout.h
+++ b/bfd/libaout.h
@@ -609,9 +609,6 @@ extern bfd_boolean NAME (aout, bfd_free_cached_info)
#define aout_32_get_section_contents _bfd_generic_get_section_contents
#define aout_64_get_section_contents _bfd_generic_get_section_contents
-#ifndef NO_WRITE_HEADER_KLUDGE
-#define NO_WRITE_HEADER_KLUDGE 0
-#endif
#ifndef aout_32_bfd_is_local_label_name
#define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2]: bfd: make aoutx.h self-contained
2020-05-26 16:13 [PATCH 0/2]: bfd: cleanups for the generic a.out support Gunther Nikl
2020-05-26 16:14 ` [PATCH 1/2]: bfd: remove unused NO_WRITE_HEADER_KLUDGE #define Gunther Nikl
@ 2020-05-26 16:16 ` Gunther Nikl
2020-05-29 3:07 ` [PATCH 0/2]: bfd: cleanups for the generic a.out support Alan Modra
2 siblings, 0 replies; 6+ messages in thread
From: Gunther Nikl @ 2020-05-26 16:16 UTC (permalink / raw)
To: binutils
The generic a.out backend support in aoutx.h requires definitions for QMAGIC
and BMAGIC. Both defines are provided by "aout/aout64.h" for a 32bit target.
Other users of aoutx.h have to provide a definition for both defines themself.
This patch makes aoutx.h self-contained with the macro N_IS_QMAGIC from
"aout/aout64.h" and by defining a similiar macro for BMAGIC. The remaining
reference to QMAGIC is replaced with a third macro: N_SET_QMAGIC. All macros
are conditionally defined depending on whether QMAGIC and BMAGIC are defined.
With this change of aoutx.h the dummy defines in aout64.c can be removed.
-- cut --
2020-05-XX Gunther Nikl <gnikl@justmail.de>
* aout64.c (BMAGIC, QMAGIC): Do not define.
* aoutx.h (N_IS_BMAGIC, N_SET_QMAGIC): New defines.
(NAME (aout, some_aout_object_p)): Use N_IS_QMAGIC and N_IS_BMAGIC
to check the file format.
(adjust_z_magic): Use N_SET_QMAGIC to set file format.
diff --git a/bfd/aout64.c b/bfd/aout64.c
index 5b43a14270..73e3cc7afe 100644
--- a/bfd/aout64.c
+++ b/bfd/aout64.c
@@ -21,12 +21,4 @@
#define ARCH_SIZE 64
-/* aoutx.h requires definitions for BMAGIC and QMAGIC. */
-#ifndef BMAGIC
-#define BMAGIC 0
-#endif
-#ifndef QMAGIC
-#define QMAGIC 0
-#endif
-
#include "aoutx.h"
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 9ffb3fe861..6ee93e104f 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -128,6 +128,18 @@ DESCRIPTION
#include "aout/stab_gnu.h"
#include "aout/ar.h"
+#ifdef BMAGIC
+#define N_IS_BMAGIC(x) (N_MAGIC (x) == BMAGIC)
+#else
+#define N_IS_BMAGIC(x) (0)
+#endif
+
+#ifdef QMAGIC
+#define N_SET_QMAGIC(x) N_SET_MAGIC (x, QMAGIC)
+#else
+#define N_SET_QMAGIC(x) do { /**/ } while (0)
+#endif
+
/*
SUBSECTION
Relocations
@@ -492,7 +504,7 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
abfd->flags |= D_PAGED | WP_TEXT;
adata (abfd).magic = z_magic;
}
- else if (N_MAGIC (execp) == QMAGIC)
+ else if (N_IS_QMAGIC (execp))
{
abfd->flags |= D_PAGED | WP_TEXT;
adata (abfd).magic = z_magic;
@@ -503,8 +515,7 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
abfd->flags |= WP_TEXT;
adata (abfd).magic = n_magic;
}
- else if (N_MAGIC (execp) == OMAGIC
- || N_MAGIC (execp) == BMAGIC)
+ else if (N_MAGIC (execp) == OMAGIC || N_IS_BMAGIC (execp))
adata (abfd).magic = o_magic;
else
/* Should have been checked with N_BADMAG before this routine
@@ -1026,7 +1037,7 @@ adjust_z_magic (bfd *abfd, struct internal_exec *execp)
if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted)))
execp->a_text += adata (abfd).exec_bytes_size;
if (obj_aout_subformat (abfd) == q_magic_format)
- N_SET_MAGIC (execp, QMAGIC);
+ N_SET_QMAGIC (execp);
else
N_SET_MAGIC (execp, ZMAGIC);
-- cut --
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2]: bfd: cleanups for the generic a.out support
2020-05-26 16:13 [PATCH 0/2]: bfd: cleanups for the generic a.out support Gunther Nikl
2020-05-26 16:14 ` [PATCH 1/2]: bfd: remove unused NO_WRITE_HEADER_KLUDGE #define Gunther Nikl
2020-05-26 16:16 ` [PATCH 2/2]: bfd: make aoutx.h self-contained Gunther Nikl
@ 2020-05-29 3:07 ` Alan Modra
2020-05-29 19:46 ` Gunther Nikl
2 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2020-05-29 3:07 UTC (permalink / raw)
To: Gunther Nikl; +Cc: binutils
On Tue, May 26, 2020 at 06:13:14PM +0200, Gunther Nikl wrote:
> Hello!
>
> This patch set for the generic BFD a.out backend removes a dead #define
> and makes aoutx.h self-contained:
>
> [PATCH 1/2]: bfd: remove unused NO_WRITE_HEADER_KLUDGE #define
> [PATCH 2/2]: bfd: make aoutx.h self-contained
Thanks, these are both OK to commit.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2]: bfd: cleanups for the generic a.out support
2020-05-29 3:07 ` [PATCH 0/2]: bfd: cleanups for the generic a.out support Alan Modra
@ 2020-05-29 19:46 ` Gunther Nikl
2020-06-03 14:26 ` Nick Clifton
0 siblings, 1 reply; 6+ messages in thread
From: Gunther Nikl @ 2020-05-29 19:46 UTC (permalink / raw)
To: Alan Modra; +Cc: binutils
Hello Alan,
> On Tue, May 26, 2020 at 06:13:14PM +0200, Gunther Nikl wrote:
> > Hello!
> >
> > This patch set for the generic BFD a.out backend removes a dead
> > #define and makes aoutx.h self-contained:
> >
> > [PATCH 1/2]: bfd: remove unused NO_WRITE_HEADER_KLUDGE #define
> > [PATCH 2/2]: bfd: make aoutx.h self-contained
>
> Thanks, these are both OK to commit.
Please commit the patches for me as I don't have write access.
Regards,
Gunther
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2]: bfd: cleanups for the generic a.out support
2020-05-29 19:46 ` Gunther Nikl
@ 2020-06-03 14:26 ` Nick Clifton
0 siblings, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2020-06-03 14:26 UTC (permalink / raw)
To: Gunther Nikl, Alan Modra; +Cc: binutils
Hi Gunther,
> Please commit the patches for me as I don't have write access.
Done.
Cheers
Nick
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-06-03 14:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 16:13 [PATCH 0/2]: bfd: cleanups for the generic a.out support Gunther Nikl
2020-05-26 16:14 ` [PATCH 1/2]: bfd: remove unused NO_WRITE_HEADER_KLUDGE #define Gunther Nikl
2020-05-26 16:16 ` [PATCH 2/2]: bfd: make aoutx.h self-contained Gunther Nikl
2020-05-29 3:07 ` [PATCH 0/2]: bfd: cleanups for the generic a.out support Alan Modra
2020-05-29 19:46 ` Gunther Nikl
2020-06-03 14:26 ` Nick Clifton
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).