Message ID | CAFULd4ZjVS4k+5jCLoRj5xeuHAN6JuTiEpHXWj-mPzBCxbewBg@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Tue, Sep 18, 2012 at 11:09 AM, Uros Bizjak <ubizjak@gmail.com> wrote: > Hello! > > CentOS 5.8 uses glibc version 2.5 that needs _GNU_SOURCE defined to use strnlen. Hm, shouldn't libiberty contain a xstrnlen? I bet strnlen isn't available everywhere. Richard. > 2012-09-18 Uros Bizjak <ubizjak@gmail.com> > > * dwarf.c: Define _GNU_SOURCE. > > Tested on CentOS x86_64-pc-linux-gnu. OK for mainline? > > Uros. > > Index: dwarf.c > =================================================================== > --- dwarf.c (revision 191413) > +++ dwarf.c (working copy) > @@ -30,6 +30,8 @@ > IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF SUCH DAMAGE. */ > > +#define _GNU_SOURCE > + > #include "config.h" > > #include <errno.h>
On Tue, Sep 18, 2012 at 11:16 AM, Richard Guenther <richard.guenther@gmail.com> wrote: >> CentOS 5.8 uses glibc version 2.5 that needs _GNU_SOURCE defined to use strnlen. > > Hm, shouldn't libiberty contain a xstrnlen? I bet strnlen isn't available > everywhere. I didn't find it in the sources. OTOH, mmapio.c already defines _GNU_SOURCE for some reason, so I just follow this approach. Uros.
On Tue, Sep 18, 2012 at 11:25 AM, Uros Bizjak <ubizjak@gmail.com> wrote: > On Tue, Sep 18, 2012 at 11:16 AM, Richard Guenther > <richard.guenther@gmail.com> wrote: > >>> CentOS 5.8 uses glibc version 2.5 that needs _GNU_SOURCE defined to use strnlen. >> >> Hm, shouldn't libiberty contain a xstrnlen? I bet strnlen isn't available >> everywhere. > > I didn't find it in the sources. OTOH, mmapio.c already defines > _GNU_SOURCE for some reason, so I just follow this approach. I said it _should_ contain xstrnlen, not that it does ;) I suppose Ian should have used strlen or added xstrnlen to libiberty. Richard. > Uros.
On Tue, Sep 18, 2012 at 2:25 AM, Uros Bizjak <ubizjak@gmail.com> wrote: > On Tue, Sep 18, 2012 at 11:16 AM, Richard Guenther > <richard.guenther@gmail.com> wrote: > >>> CentOS 5.8 uses glibc version 2.5 that needs _GNU_SOURCE defined to use strnlen. >> >> Hm, shouldn't libiberty contain a xstrnlen? I bet strnlen isn't available >> everywhere. > > I didn't find it in the sources. OTOH, mmapio.c already defines > _GNU_SOURCE for some reason, so I just follow this approach. mmapio.c uses _GNU_SOURCE so that getpagesize is available on GNU/Linux systems. I'll fix the strnlen issue some other way. Ian
Ian Lance Taylor <iant@google.com> writes:
> mmapio.c uses _GNU_SOURCE so that getpagesize is available on GNU/Linux systems.
That should be available by default (which includes BSD things) unless
the namespace has been restricted in some other way.
There's of course also the POSIX way of using sysconf(_SC_PAGESIZE).
Andreas.
On Tue, Sep 18, 2012 at 7:08 AM, Ian Lance Taylor <iant@google.com> wrote: > > I'll fix the strnlen issue some other way. I committed a pair of patches, to libiberty and libbacktrace, that should fix the problem. Let me know if it is still present. Sorry for the difficulty. Ian
On Tue, 18 Sep 2012, Uros Bizjak wrote: > Index: dwarf.c > =================================================================== > --- dwarf.c (revision 191413) > +++ dwarf.c (working copy) > @@ -30,6 +30,8 @@ > IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF SUCH DAMAGE. */ > > +#define _GNU_SOURCE I think AC_USE_SYSTEM_EXTENSIONS is preferred to defining _GNU_SOURCE in individual source files.
On Tue, Sep 18, 2012 at 9:08 AM, Joseph S. Myers <joseph@codesourcery.com> wrote: > > I think AC_USE_SYSTEM_EXTENSIONS is preferred to defining _GNU_SOURCE in > individual source files. Thanks for the pointer. I have committed this patch after bootstrap and libbacktrace test on x86_64-unknown-linux-gnu. Ian 2012-09-18 Ian Lance Taylor <iant@google.com> * configure.ac: Add AC_USE_SYSTEM_EXTENSIONS. * mmapio.c: Don't define _GNU_SOURCE. * configure, config.h.in: Rebuild.
Index: dwarf.c =================================================================== --- dwarf.c (revision 191413) +++ dwarf.c (working copy) @@ -30,6 +30,8 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define _GNU_SOURCE + #include "config.h" #include <errno.h>