All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] uapi/linux/a.out.h: don't use deprecated system-specific predefines.
@ 2017-06-01 21:00 Zack Weinberg
  2017-06-02  7:10 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Zack Weinberg @ 2017-06-01 21:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds

uapi/linux/a.out.h uses a number of predefined macros that are
deprecated because they're in the application namespace
(e.g. '#ifdef linux' instead of '#ifdef __linux__').
This patch corrects all of them.

The primary reason this is worth bothering to fix, considering how
obsolete a.out binary support is, is that the GCC build process
considers this such a severe error that it will copy the header into a
private directory and change the macro names, which causes future
updates to the header to be masked.  This header probably doesn't get
updated very often anymore, but it is the _only_ uapi header that gets
this treatment, so IMHO it is worth patching just to drive that number
all the way to zero.

Signed-off-by: Zack Weinberg <zackw@panix.com>
---
 include/uapi/linux/a.out.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/uapi/linux/a.out.h b/include/uapi/linux/a.out.h
index 7caf44c7fa51..e163133cf1b0 100644
--- a/include/uapi/linux/a.out.h
+++ b/include/uapi/linux/a.out.h
@@ -115,21 +115,21 @@ enum machine_type {
 /* Address of data segment in memory after it is loaded.
    Note that it is up to you to define SEGMENT_SIZE
    on machines not listed here.  */
-#if defined(vax) || defined(hp300) || defined(pyr)
+#if defined(__vax__) || defined(__hp300__) || defined(__pyr__)
 #define SEGMENT_SIZE page_size
 #endif
-#ifdef	sony
+#ifdef	__sony__
 #define	SEGMENT_SIZE	0x2000
 #endif	/* Sony.  */
-#ifdef is68k
+#ifdef __is68k__
 #define SEGMENT_SIZE 0x20000
 #endif
-#if defined(m68k) && defined(PORTAR)
+#if defined(__m68k__) && defined(__PORTAR__)
 #define PAGE_SIZE 0x400
 #define SEGMENT_SIZE PAGE_SIZE
 #endif
 
-#ifdef linux
+#ifdef __linux__
 #ifndef __KERNEL__
 #include <unistd.h>
 #endif
@@ -260,7 +260,7 @@ struct relocation_info
   unsigned int r_extern:1;
   /* Four bits that aren't used, but when writing an object file
      it is desirable to clear them.  */
-#ifdef NS32K
+#ifdef __NS32K__
   unsigned r_bsr:1;
   unsigned r_disp:1;
   unsigned r_pad:2;
-- 
2.11.0

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

* Re: [PATCH] uapi/linux/a.out.h: don't use deprecated system-specific predefines.
  2017-06-01 21:00 [PATCH] uapi/linux/a.out.h: don't use deprecated system-specific predefines Zack Weinberg
@ 2017-06-02  7:10 ` Christoph Hellwig
  2017-06-02 12:06   ` Zack Weinberg
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2017-06-02  7:10 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: linux-kernel, Linus Torvalds

>  /* Address of data segment in memory after it is loaded.
>     Note that it is up to you to define SEGMENT_SIZE
>     on machines not listed here.  */
> -#if defined(vax) || defined(hp300) || defined(pyr)
> +#if defined(__vax__) || defined(__hp300__) || defined(__pyr__)
>  #define SEGMENT_SIZE page_size
>  #endif
> -#ifdef	sony
> +#ifdef	__sony__
>  #define	SEGMENT_SIZE	0x2000
>  #endif	/* Sony.  */
> -#ifdef is68k
> +#ifdef __is68k__
>  #define SEGMENT_SIZE 0x20000
>  #endif
> -#if defined(m68k) && defined(PORTAR)
> +#if defined(__m68k__) && defined(__PORTAR__)
>  #define PAGE_SIZE 0x400
>  #define SEGMENT_SIZE PAGE_SIZE
>  #endif

Can we please fix these conditionals so that only those
relevant to Linux remain?  e.g. something like the patch below:


diff --git a/include/uapi/linux/a.out.h b/include/uapi/linux/a.out.h
index 7caf44c7fa51..295cd3ef6330 100644
--- a/include/uapi/linux/a.out.h
+++ b/include/uapi/linux/a.out.h
@@ -112,24 +112,7 @@ enum machine_type {
 #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
 #endif
 
-/* Address of data segment in memory after it is loaded.
-   Note that it is up to you to define SEGMENT_SIZE
-   on machines not listed here.  */
-#if defined(vax) || defined(hp300) || defined(pyr)
-#define SEGMENT_SIZE page_size
-#endif
-#ifdef	sony
-#define	SEGMENT_SIZE	0x2000
-#endif	/* Sony.  */
-#ifdef is68k
-#define SEGMENT_SIZE 0x20000
-#endif
-#if defined(m68k) && defined(PORTAR)
-#define PAGE_SIZE 0x400
-#define SEGMENT_SIZE PAGE_SIZE
-#endif
-
-#ifdef linux
+/* Address of data segment in memory after it is loaded. */
 #ifndef __KERNEL__
 #include <unistd.h>
 #endif
@@ -142,7 +125,6 @@ enum machine_type {
 #endif
 #endif
 #endif
-#endif
 
 #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
 
@@ -260,13 +242,7 @@ struct relocation_info
   unsigned int r_extern:1;
   /* Four bits that aren't used, but when writing an object file
      it is desirable to clear them.  */
-#ifdef NS32K
-  unsigned r_bsr:1;
-  unsigned r_disp:1;
-  unsigned r_pad:2;
-#else
   unsigned int r_pad:4;
-#endif
 };
 #endif /* no N_RELOCATION_INFO_DECLARED.  */
 

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

* Re: [PATCH] uapi/linux/a.out.h: don't use deprecated system-specific predefines.
  2017-06-02  7:10 ` Christoph Hellwig
@ 2017-06-02 12:06   ` Zack Weinberg
  2017-06-02 19:12     ` Linus Torvalds
  0 siblings, 1 reply; 6+ messages in thread
From: Zack Weinberg @ 2017-06-02 12:06 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel, Linus Torvalds

On 06/02/2017 03:10 AM, Christoph Hellwig wrote:
>
> Can we please fix these conditionals so that only those
> relevant to Linux remain?

I was going for the minimal change since this is dusty-deck code that I
can't practically test, but I have no objection to your more thorough
approach.  I don't see anything I would do differently.

zw

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

* Re: [PATCH] uapi/linux/a.out.h: don't use deprecated system-specific predefines.
  2017-06-02 12:06   ` Zack Weinberg
@ 2017-06-02 19:12     ` Linus Torvalds
  2017-06-14 12:43       ` Zack Weinberg
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Torvalds @ 2017-06-02 19:12 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Christoph Hellwig, Linux Kernel Mailing List

On Fri, Jun 2, 2017 at 5:06 AM, Zack Weinberg <zackw@panix.com> wrote:
> On 06/02/2017 03:10 AM, Christoph Hellwig wrote:
>>
>> Can we please fix these conditionals so that only those
>> relevant to Linux remain?
>
> I was going for the minimal change since this is dusty-deck code that I
> can't practically test, but I have no objection to your more thorough
> approach.  I don't see anything I would do differently.

Yes, I think I'd just prefer to rip out the stale stuff, and remove
the "#ifdef linux" entirely.

It's not like the kernel wants non-linux headers, and I don't see
non-linux users using the kernel headers either.

               Linus

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

* Re: [PATCH] uapi/linux/a.out.h: don't use deprecated system-specific predefines.
  2017-06-02 19:12     ` Linus Torvalds
@ 2017-06-14 12:43       ` Zack Weinberg
  2017-06-14 15:14         ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Zack Weinberg @ 2017-06-14 12:43 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Christoph Hellwig, Linux Kernel Mailing List

On Fri, Jun 2, 2017 at 3:12 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Fri, Jun 2, 2017 at 5:06 AM, Zack Weinberg <zackw@panix.com> wrote:
>> On 06/02/2017 03:10 AM, Christoph Hellwig wrote:
>>>
>>> Can we please fix these conditionals so that only those
>>> relevant to Linux remain?
>>
>> I was going for the minimal change since this is dusty-deck code that I
>> can't practically test, but I have no objection to your more thorough
>> approach.  I don't see anything I would do differently.
>
> Yes, I think I'd just prefer to rip out the stale stuff, and remove
> the "#ifdef linux" entirely.
>
> It's not like the kernel wants non-linux headers, and I don't see
> non-linux users using the kernel headers either.

Christoph's patch doesn't seem to have been applied yet.  Is there
anything I can do to help?

zw

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

* Re: [PATCH] uapi/linux/a.out.h: don't use deprecated system-specific predefines.
  2017-06-14 12:43       ` Zack Weinberg
@ 2017-06-14 15:14         ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2017-06-14 15:14 UTC (permalink / raw)
  To: Zack Weinberg
  Cc: Linus Torvalds, Christoph Hellwig, Linux Kernel Mailing List

On Wed, Jun 14, 2017 at 08:43:08AM -0400, Zack Weinberg wrote:
> Christoph's patch doesn't seem to have been applied yet.  Is there
> anything I can do to help?

A formal submission usually helps.  I didn't want to post it under
my name as it's mostly your work.  How about this:

---
From: Zack Weinberg <zackw@panix.com>
Subject: uapi/linux/a.out.h: don't use deprecated system-specific predefines.

uapi/linux/a.out.h uses a number of predefined macros that are
deprecated because they're in the application namespace
(e.g. '#ifdef linux' instead of '#ifdef __linux__').
This patch either corrects or just removes them if they are not
applicable to Linux.

The primary reason this is worth bothering to fix, considering how
obsolete a.out binary support is, is that the GCC build process
considers this such a severe error that it will copy the header into a
private directory and change the macro names, which causes future
updates to the header to be masked.  This header probably doesn't get
updated very often anymore, but it is the _only_ uapi header that gets
this treatment, so IMHO it is worth patching just to drive that number
all the way to zero.

Signed-off-by: Zack Weinberg <zackw@panix.com>
[hch: removed dead conditionals]
Signed-off-by: Christoph Hellwig <hch@lst.de>

diff --git a/include/uapi/linux/a.out.h b/include/uapi/linux/a.out.h
index 7caf44c7fa51..295cd3ef6330 100644
--- a/include/uapi/linux/a.out.h
+++ b/include/uapi/linux/a.out.h
@@ -112,24 +112,7 @@ enum machine_type {
 #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
 #endif
 
-/* Address of data segment in memory after it is loaded.
-   Note that it is up to you to define SEGMENT_SIZE
-   on machines not listed here.  */
-#if defined(vax) || defined(hp300) || defined(pyr)
-#define SEGMENT_SIZE page_size
-#endif
-#ifdef	sony
-#define	SEGMENT_SIZE	0x2000
-#endif	/* Sony.  */
-#ifdef is68k
-#define SEGMENT_SIZE 0x20000
-#endif
-#if defined(m68k) && defined(PORTAR)
-#define PAGE_SIZE 0x400
-#define SEGMENT_SIZE PAGE_SIZE
-#endif
-
-#ifdef linux
+/* Address of data segment in memory after it is loaded. */
 #ifndef __KERNEL__
 #include <unistd.h>
 #endif
@@ -142,7 +125,6 @@ enum machine_type {
 #endif
 #endif
 #endif
-#endif
 
 #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
 
@@ -260,13 +242,7 @@ struct relocation_info
   unsigned int r_extern:1;
   /* Four bits that aren't used, but when writing an object file
      it is desirable to clear them.  */
-#ifdef NS32K
-  unsigned r_bsr:1;
-  unsigned r_disp:1;
-  unsigned r_pad:2;
-#else
   unsigned int r_pad:4;
-#endif
 };
 #endif /* no N_RELOCATION_INFO_DECLARED.  */
 

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

end of thread, other threads:[~2017-06-14 15:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-01 21:00 [PATCH] uapi/linux/a.out.h: don't use deprecated system-specific predefines Zack Weinberg
2017-06-02  7:10 ` Christoph Hellwig
2017-06-02 12:06   ` Zack Weinberg
2017-06-02 19:12     ` Linus Torvalds
2017-06-14 12:43       ` Zack Weinberg
2017-06-14 15:14         ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.