diff mbox

libgo - fix build errors and add ARM bits

Message ID 50AA5DF7.6020102@ubuntu.com
State New
Headers show

Commit Message

Matthias Klose Nov. 19, 2012, 4:27 p.m. UTC
libgo-fix-arm.diff: Work around parse error of struct timex_ on ARM (both trunk
and 4.7 branch).

libgo-hardening.diff: Avoid compiler warnings in libgo with -D_FORTIFY_SOURCE=2,
which let the build fail with -Werror. first chunk for the trunk and 4.7, second
chunk for trunk only.

libgo-mksysinfo.diff: Fix TIOCNOTTY and TIOCSCTTY definitions, afaicr needed for
ARM as well. for trunk and 4.7.

I did sign the contributors agreement at
http://golang.org/doc/contribute.html#copyright, however I didn't get any
feedback or acknowledgement yet.

  Matthias

Comments

Ian Lance Taylor Dec. 4, 2012, 6:26 a.m. UTC | #1
On Mon, Nov 19, 2012 at 8:27 AM, Matthias Klose <doko@ubuntu.com> wrote:
> libgo-fix-arm.diff: Work around parse error of struct timex_ on ARM (both trunk
> and 4.7 branch).
>
> libgo-hardening.diff: Avoid compiler warnings in libgo with -D_FORTIFY_SOURCE=2,
> which let the build fail with -Werror. first chunk for the trunk and 4.7, second
> chunk for trunk only.
>
> libgo-mksysinfo.diff: Fix TIOCNOTTY and TIOCSCTTY definitions, afaicr needed for
> ARM as well. for trunk and 4.7.

Thanks.  I committed the libgo-hardening and libgo-mksysinfo patches
to mainline and 4.7 branch.


Can you tell me more about the libgo-fix-arm patch?  The patch adds
these lines to mksysinfo.sh:

+# ARM
+sed -i '/type _timex/s/INVALID-bit-field/int32/g;/type _timex/s,^//
,,' gen-sysinfo.go

I don't understand why there would an INVALID-bit-field on ARM.  This
struct comes from the <sys/timex.h>, which as far as I can see should
be the same on every glibc system.

What does struct timex look like in your <sys/timex.h> file?  What
does the line look like in gen-sysinfo.go before the sed script above
is run?

Ian
Matthias Klose Dec. 4, 2012, 6:47 a.m. UTC | #2
Am 04.12.2012 07:26, schrieb Ian Lance Taylor:
> On Mon, Nov 19, 2012 at 8:27 AM, Matthias Klose <doko@ubuntu.com> wrote:
>> libgo-fix-arm.diff: Work around parse error of struct timex_ on ARM (both trunk
>> and 4.7 branch).
>>
>> libgo-hardening.diff: Avoid compiler warnings in libgo with -D_FORTIFY_SOURCE=2,
>> which let the build fail with -Werror. first chunk for the trunk and 4.7, second
>> chunk for trunk only.
>>
>> libgo-mksysinfo.diff: Fix TIOCNOTTY and TIOCSCTTY definitions, afaicr needed for
>> ARM as well. for trunk and 4.7.
> 
> Thanks.  I committed the libgo-hardening and libgo-mksysinfo patches
> to mainline and 4.7 branch.
> 
> 
> Can you tell me more about the libgo-fix-arm patch?  The patch adds
> these lines to mksysinfo.sh:
> 
> +# ARM
> +sed -i '/type _timex/s/INVALID-bit-field/int32/g;/type _timex/s,^//
> ,,' gen-sysinfo.go
> 
> I don't understand why there would an INVALID-bit-field on ARM.  This
> struct comes from the <sys/timex.h>, which as far as I can see should
> be the same on every glibc system.
> 
> What does struct timex look like in your <sys/timex.h> file?  What
> does the line look like in gen-sysinfo.go before the sed script above
> is run?

defined in bits/timex.h

struct timex
{
  unsigned int modes;           /* mode selector */
  __syscall_slong_t offset;     /* time offset (usec) */
  __syscall_slong_t freq;       /* frequency offset (scaled ppm) */
  __syscall_slong_t maxerror;   /* maximum error (usec) */
  __syscall_slong_t esterror;   /* estimated error (usec) */
  int status;                   /* clock command/status */
  __syscall_slong_t constant;   /* pll time constant */
  __syscall_slong_t precision;  /* clock precision (usec) (ro) */
  __syscall_slong_t tolerance;  /* clock frequency tolerance (ppm) (ro) */
  struct timeval time;          /* (read only) */
  __syscall_slong_t tick;       /* (modified) usecs between clock ticks */
  __syscall_slong_t ppsfreq;    /* pps frequency (scaled ppm) (ro) */
  __syscall_slong_t jitter;     /* pps jitter (us) (ro) */
  int shift;                    /* interval duration (s) (shift) (ro) */
  __syscall_slong_t stabil;     /* pps stability (scaled ppm) (ro) */
  __syscall_slong_t jitcnt;     /* jitter limit exceeded (ro) */
  __syscall_slong_t calcnt;     /* calibration intervals (ro) */
  __syscall_slong_t errcnt;     /* calibration errors (ro) */
  __syscall_slong_t stbcnt;     /* stability limit exceeded (ro) */

  int tai;                      /* TAI offset (ro) */

  /* ??? */
  int  :32; int  :32; int  :32; int  :32;
  int  :32; int  :32; int  :32; int  :32;
  int  :32; int  :32; int  :32;
};


I'll have to re-run the build with out the patch, but this replaces just the
32bit bit fields with an int32.

  Matthias
Ian Lance Taylor Dec. 4, 2012, 7:03 a.m. UTC | #3
On Mon, Dec 3, 2012 at 10:47 PM, Matthias Klose <doko@ubuntu.com> wrote:
> Am 04.12.2012 07:26, schrieb Ian Lance Taylor:
>> On Mon, Nov 19, 2012 at 8:27 AM, Matthias Klose <doko@ubuntu.com> wrote:
>>> libgo-fix-arm.diff: Work around parse error of struct timex_ on ARM (both trunk
>>> and 4.7 branch).
>>>
>>> libgo-hardening.diff: Avoid compiler warnings in libgo with -D_FORTIFY_SOURCE=2,
>>> which let the build fail with -Werror. first chunk for the trunk and 4.7, second
>>> chunk for trunk only.
>>>
>>> libgo-mksysinfo.diff: Fix TIOCNOTTY and TIOCSCTTY definitions, afaicr needed for
>>> ARM as well. for trunk and 4.7.
>>
>> Thanks.  I committed the libgo-hardening and libgo-mksysinfo patches
>> to mainline and 4.7 branch.
>>
>>
>> Can you tell me more about the libgo-fix-arm patch?  The patch adds
>> these lines to mksysinfo.sh:
>>
>> +# ARM
>> +sed -i '/type _timex/s/INVALID-bit-field/int32/g;/type _timex/s,^//
>> ,,' gen-sysinfo.go
>>
>> I don't understand why there would an INVALID-bit-field on ARM.  This
>> struct comes from the <sys/timex.h>, which as far as I can see should
>> be the same on every glibc system.
>>
>> What does struct timex look like in your <sys/timex.h> file?  What
>> does the line look like in gen-sysinfo.go before the sed script above
>> is run?
>
> defined in bits/timex.h
>
> struct timex
> {
>   unsigned int modes;           /* mode selector */
>   __syscall_slong_t offset;     /* time offset (usec) */
>   __syscall_slong_t freq;       /* frequency offset (scaled ppm) */
>   __syscall_slong_t maxerror;   /* maximum error (usec) */
>   __syscall_slong_t esterror;   /* estimated error (usec) */
>   int status;                   /* clock command/status */
>   __syscall_slong_t constant;   /* pll time constant */
>   __syscall_slong_t precision;  /* clock precision (usec) (ro) */
>   __syscall_slong_t tolerance;  /* clock frequency tolerance (ppm) (ro) */
>   struct timeval time;          /* (read only) */
>   __syscall_slong_t tick;       /* (modified) usecs between clock ticks */
>   __syscall_slong_t ppsfreq;    /* pps frequency (scaled ppm) (ro) */
>   __syscall_slong_t jitter;     /* pps jitter (us) (ro) */
>   int shift;                    /* interval duration (s) (shift) (ro) */
>   __syscall_slong_t stabil;     /* pps stability (scaled ppm) (ro) */
>   __syscall_slong_t jitcnt;     /* jitter limit exceeded (ro) */
>   __syscall_slong_t calcnt;     /* calibration intervals (ro) */
>   __syscall_slong_t errcnt;     /* calibration errors (ro) */
>   __syscall_slong_t stbcnt;     /* stability limit exceeded (ro) */
>
>   int tai;                      /* TAI offset (ro) */
>
>   /* ??? */
>   int  :32; int  :32; int  :32; int  :32;
>   int  :32; int  :32; int  :32; int  :32;
>   int  :32; int  :32; int  :32;
> };
>
>
> I'll have to re-run the build with out the patch, but this replaces just the
> 32bit bit fields with an int32.

Thanks.  That's more or less what timex.h looks like on my system, but
I don't see the bitfields.  GCC treats the :32 fields as int32, in
both 32-bit and 64-bit mode.

Ian
Matthias Klose Dec. 4, 2012, 7:38 a.m. UTC | #4
Am 04.12.2012 08:03, schrieb Ian Lance Taylor:
> On Mon, Dec 3, 2012 at 10:47 PM, Matthias Klose <doko@ubuntu.com> wrote:
>> Am 04.12.2012 07:26, schrieb Ian Lance Taylor:
>>> On Mon, Nov 19, 2012 at 8:27 AM, Matthias Klose <doko@ubuntu.com> wrote:
>>>> libgo-fix-arm.diff: Work around parse error of struct timex_ on ARM (both trunk
>>>> and 4.7 branch).
>>>>
>>>> libgo-hardening.diff: Avoid compiler warnings in libgo with -D_FORTIFY_SOURCE=2,
>>>> which let the build fail with -Werror. first chunk for the trunk and 4.7, second
>>>> chunk for trunk only.
>>>>
>>>> libgo-mksysinfo.diff: Fix TIOCNOTTY and TIOCSCTTY definitions, afaicr needed for
>>>> ARM as well. for trunk and 4.7.
>>>
>>> Thanks.  I committed the libgo-hardening and libgo-mksysinfo patches
>>> to mainline and 4.7 branch.
>>>
>>>
>>> Can you tell me more about the libgo-fix-arm patch?  The patch adds
>>> these lines to mksysinfo.sh:
>>>
>>> +# ARM
>>> +sed -i '/type _timex/s/INVALID-bit-field/int32/g;/type _timex/s,^//
>>> ,,' gen-sysinfo.go
>>>
>>> I don't understand why there would an INVALID-bit-field on ARM.  This
>>> struct comes from the <sys/timex.h>, which as far as I can see should
>>> be the same on every glibc system.
>>>
>>> What does struct timex look like in your <sys/timex.h> file?  What
>>> does the line look like in gen-sysinfo.go before the sed script above
>>> is run?
>>
>> defined in bits/timex.h
>>
>> struct timex
>> {
>>   unsigned int modes;           /* mode selector */
>>   __syscall_slong_t offset;     /* time offset (usec) */
>>   __syscall_slong_t freq;       /* frequency offset (scaled ppm) */
>>   __syscall_slong_t maxerror;   /* maximum error (usec) */
>>   __syscall_slong_t esterror;   /* estimated error (usec) */
>>   int status;                   /* clock command/status */
>>   __syscall_slong_t constant;   /* pll time constant */
>>   __syscall_slong_t precision;  /* clock precision (usec) (ro) */
>>   __syscall_slong_t tolerance;  /* clock frequency tolerance (ppm) (ro) */
>>   struct timeval time;          /* (read only) */
>>   __syscall_slong_t tick;       /* (modified) usecs between clock ticks */
>>   __syscall_slong_t ppsfreq;    /* pps frequency (scaled ppm) (ro) */
>>   __syscall_slong_t jitter;     /* pps jitter (us) (ro) */
>>   int shift;                    /* interval duration (s) (shift) (ro) */
>>   __syscall_slong_t stabil;     /* pps stability (scaled ppm) (ro) */
>>   __syscall_slong_t jitcnt;     /* jitter limit exceeded (ro) */
>>   __syscall_slong_t calcnt;     /* calibration intervals (ro) */
>>   __syscall_slong_t errcnt;     /* calibration errors (ro) */
>>   __syscall_slong_t stbcnt;     /* stability limit exceeded (ro) */
>>
>>   int tai;                      /* TAI offset (ro) */
>>
>>   /* ??? */
>>   int  :32; int  :32; int  :32; int  :32;
>>   int  :32; int  :32; int  :32; int  :32;
>>   int  :32; int  :32; int  :32;
>> };
>>
>>
>> I'll have to re-run the build with out the patch, but this replaces just the
>> 32bit bit fields with an int32.
> 
> Thanks.  That's more or less what timex.h looks like on my system, but
> I don't see the bitfields.  GCC treats the :32 fields as int32, in
> both 32-bit and 64-bit mode.

sorry, this was fixed with the patch for PR52557.
Ian Lance Taylor Dec. 4, 2012, 7:42 a.m. UTC | #5
On Mon, Dec 3, 2012 at 11:38 PM, Matthias Klose <doko@ubuntu.com> wrote:
> Am 04.12.2012 08:03, schrieb Ian Lance Taylor:
>> On Mon, Dec 3, 2012 at 10:47 PM, Matthias Klose <doko@ubuntu.com> wrote:
>>> Am 04.12.2012 07:26, schrieb Ian Lance Taylor:
>>>> On Mon, Nov 19, 2012 at 8:27 AM, Matthias Klose <doko@ubuntu.com> wrote:
>>>>> libgo-fix-arm.diff: Work around parse error of struct timex_ on ARM (both trunk
>>>>> and 4.7 branch).
>>>>>
>>>>> libgo-hardening.diff: Avoid compiler warnings in libgo with -D_FORTIFY_SOURCE=2,
>>>>> which let the build fail with -Werror. first chunk for the trunk and 4.7, second
>>>>> chunk for trunk only.
>>>>>
>>>>> libgo-mksysinfo.diff: Fix TIOCNOTTY and TIOCSCTTY definitions, afaicr needed for
>>>>> ARM as well. for trunk and 4.7.
>>>>
>>>> Thanks.  I committed the libgo-hardening and libgo-mksysinfo patches
>>>> to mainline and 4.7 branch.
>>>>
>>>>
>>>> Can you tell me more about the libgo-fix-arm patch?  The patch adds
>>>> these lines to mksysinfo.sh:
>>>>
>>>> +# ARM
>>>> +sed -i '/type _timex/s/INVALID-bit-field/int32/g;/type _timex/s,^//
>>>> ,,' gen-sysinfo.go
>>>>
>>>> I don't understand why there would an INVALID-bit-field on ARM.  This
>>>> struct comes from the <sys/timex.h>, which as far as I can see should
>>>> be the same on every glibc system.
>>>>
>>>> What does struct timex look like in your <sys/timex.h> file?  What
>>>> does the line look like in gen-sysinfo.go before the sed script above
>>>> is run?
>>>
>>> defined in bits/timex.h
>>>
>>> struct timex
>>> {
>>>   unsigned int modes;           /* mode selector */
>>>   __syscall_slong_t offset;     /* time offset (usec) */
>>>   __syscall_slong_t freq;       /* frequency offset (scaled ppm) */
>>>   __syscall_slong_t maxerror;   /* maximum error (usec) */
>>>   __syscall_slong_t esterror;   /* estimated error (usec) */
>>>   int status;                   /* clock command/status */
>>>   __syscall_slong_t constant;   /* pll time constant */
>>>   __syscall_slong_t precision;  /* clock precision (usec) (ro) */
>>>   __syscall_slong_t tolerance;  /* clock frequency tolerance (ppm) (ro) */
>>>   struct timeval time;          /* (read only) */
>>>   __syscall_slong_t tick;       /* (modified) usecs between clock ticks */
>>>   __syscall_slong_t ppsfreq;    /* pps frequency (scaled ppm) (ro) */
>>>   __syscall_slong_t jitter;     /* pps jitter (us) (ro) */
>>>   int shift;                    /* interval duration (s) (shift) (ro) */
>>>   __syscall_slong_t stabil;     /* pps stability (scaled ppm) (ro) */
>>>   __syscall_slong_t jitcnt;     /* jitter limit exceeded (ro) */
>>>   __syscall_slong_t calcnt;     /* calibration intervals (ro) */
>>>   __syscall_slong_t errcnt;     /* calibration errors (ro) */
>>>   __syscall_slong_t stbcnt;     /* stability limit exceeded (ro) */
>>>
>>>   int tai;                      /* TAI offset (ro) */
>>>
>>>   /* ??? */
>>>   int  :32; int  :32; int  :32; int  :32;
>>>   int  :32; int  :32; int  :32; int  :32;
>>>   int  :32; int  :32; int  :32;
>>> };
>>>
>>>
>>> I'll have to re-run the build with out the patch, but this replaces just the
>>> 32bit bit fields with an int32.
>>
>> Thanks.  That's more or less what timex.h looks like on my system, but
>> I don't see the bitfields.  GCC treats the :32 fields as int32, in
>> both 32-bit and 64-bit mode.
>
> sorry, this was fixed with the patch for PR52557.

Oh yeah.  Thanks for looking into it.

Ian
diff mbox

Patch

# DP: libgo: Fix TIOCNOTTY and TIOCSCTTY definitions

Index: b/src/libgo/mksysinfo.sh
===================================================================
--- a/src/libgo/mksysinfo.sh
+++ b/src/libgo/mksysinfo.sh
@@ -168,6 +168,12 @@ 
 #ifdef TIOCGWINSZ
   TIOCGWINSZ_val = TIOCGWINSZ,
 #endif
+#ifdef TIOCNOTTY
+  TIOCNOTTY_val = TIOCNOTTY,
+#endif
+#ifdef TIOCSCTTY
+  TIOCSCTTY_val = TIOCSCTTY,
+#endif
 };
 EOF
 
@@ -728,6 +734,16 @@ 
     echo 'const TIOCGWINSZ = _TIOCGWINSZ_val' >> ${OUT}
   fi
 fi
+if ! grep '^const TIOCNOTTY' ${OUT} >/dev/null 2>&1; then
+  if grep '^const _TIOCNOTTY_val' ${OUT} >/dev/null 2>&1; then
+    echo 'const TIOCNOTTY = _TIOCNOTTY_val' >> ${OUT}
+  fi
+fi
+if ! grep '^const TIOCSCTTY' ${OUT} >/dev/null 2>&1; then
+  if grep '^const _TIOCSCTTY_val' ${OUT} >/dev/null 2>&1; then
+    echo 'const TIOCSCTTY = _TIOCSCTTY_val' >> ${OUT}
+  fi
+fi
 
 # The ioctl flags for terminal control
 grep '^const _TC[GS]ET' gen-sysinfo.go | \