[PATCH] binutils/nm.c: Skip sbrk() under Darwin when _POSIX_C_SOURCE not defined
Tristan Gingold
gingold@adacore.com
Mon Sep 15 13:55:00 GMT 2014
On 15 Sep 2014, at 15:31, Chen Gang <gang.chen.5i5j@gmail.com> wrote:
>
>
> On 9/15/14 21:21, Tristan Gingold wrote:
>> Hello,
>>
>> On 15 Sep 2014, at 15:20, Chen Gang <gang.chen.5i5j@gmail.com> wrote:
>> [...]
>>> --- a/binutils/nm.c
>>> +++ b/binutils/nm.c
>>> @@ -1698,6 +1698,7 @@ main (int argc, char **argv)
>>> END_PROGRESS (program_name);
>>>
>>> #ifdef HAVE_SBRK
>>> +#if !defined (__DARWIN_C_LEVEL) || defined (_POSIX_C_SOURCE)
>>> if (show_stats)
>>> {
>>> char *lim = (char *) sbrk (0);
>>> @@ -1705,6 +1706,7 @@ main (int argc, char **argv)
>>> non_fatal (_("data size %ld"), (long) (lim - (char *) &environ));
>>> }
>>> #endif
>>> +#endif
>>
>> Enable code on machine specific macro is not recommended by the GNU standard.
>> Also note that sbrk is also used by gas.
>>
>> Maybe the test of sbrk in configure should be done using warnings flags.
>>
>> (the work-around is to configure using --disable-werror).
>>
>
> Originally, I really tried to do that, but I found that HAVE_SBRK really
> need be true under Darwin, but may report warning.
Can you clarify that ? IIRC, the only use of sbrk within binutils is to
compute the amount of memory used.
Tristan.
More information about the Binutils
mailing list