public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Nicholas Guriev <nicholas@guriev.su>
To: libc-help@sourceware.org
Subject: [RFC PATCH v1 0/1] Debug build?
Date: Mon, 2 May 2022 17:11:57 +0300	[thread overview]
Message-ID: <cover.1651500717.git.nicholas@guriev.su> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3308 bytes --]

Hello everyone!

How do I get rid of <optimized out> in GDB from glibc sources? I am used to the
-O0 compiler flag in this case, but the libc-symbols.h file blocks
non-optimized build. For what reason?

I have built glibc with CFLAGS='-ggdb3 -Og' but they still do too many
optimizations so the debugger cannot see local variables. And there is a
similar bug report in GCC, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78685

Can we fix this on glibc side? I am attaching a work-in-progress patch that
removes an #error directive and adds some __always_inline optimizations to
strictly necessary functions. Unfortunately, I don't fully understand which
consequences it may imply.

But if glibc developers are interested, I'll be happy to putt the patch in
order.


Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7fd6b1c in elf_machine_rela (skip_ifunc=0, reloc_addr_arg=0x7ffff7fb9fe0, version=0x18, sym=0x7ffff7fb6330, reloc=0x7ffff7fb64b0, scope=0x7ffff7fbc148, map=0x7ffff7fbbdc0) at ../sysdeps/x86_64/dl-machine.h:280
(gdb) i locals
_lr = <optimized out>
_tc = 4
v = 0x0
refsym = 0x7ffff7fb6330
sym_map = <optimized out>
value = <optimized out>
reloc_addr = 0x7ffff7fb9fe0
r_type = 6
reloc_addr = <optimized out>
r_type = <optimized out>
print_err = <optimized out>
refsym = <optimized out>
sym_map = <optimized out>
value = <optimized out>
_lr = <optimized out>
_tc = <optimized out>
v = <optimized out>
strtab = <optimized out>
fmt = <optimized out>
td = <optimized out>
strtab = <optimized out>
(gdb) bt
#0  0x00007ffff7fd6b1c in elf_machine_rela (skip_ifunc=0, reloc_addr_arg=0x7ffff7fb9fe0, version=0x18, sym=0x7ffff7fb6330, reloc=0x7ffff7fb64b0, scope=0x7ffff7fbc148, map=0x7ffff7fbbdc0) at ../sysdeps/x86_64/dl-machine.h:280
#1  0x00007ffff7fd6b1c in elf_dynamic_do_Rela (skip_ifunc=<optimized out>, lazy=<optimized out>, nrelative=<optimized out>, relsize=<optimized out>, reladdr=<optimized out>, scope=<optimized out>, map=0x7ffff7fbbdc0) at /home/mymedia/код/система/glibc/elf/do-rel.h:147
#2  0x00007ffff7fd6b1c in _dl_relocate_object (l=<optimized out>, scope=<optimized out>, reloc_mode=<optimized out>, consider_profiling=<optimized out>) at dl-reloc.c:288
#3  0x00007ffff7fe8450 in dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:2288
#4  0x00007ffff7fe32c5 in _dl_sysdep_start (start_argptr=<optimized out>, dl_main=0x7ffff7fe60df <dl_main>) at ../sysdeps/unix/sysv/linux/dl-sysdep.c:140
#5  0x00007ffff7fe5ffe in _dl_start_final (arg=0x7fffffffd7c0) at rtld.c:510
#6  0x00007ffff7fe5ffe in _dl_start (arg=0x7fffffffd7c0) at rtld.c:597
#7  0x00007ffff7fe3bd8 in _start () from /home/mymedia/код/система/glibc/build/elf/ld.so


Nicholas Guriev (1):
  draft: Make non-optimized build possible

 include/alloc_buffer.h             | 76 ++++++++++++++++--------------
 include/libc-symbols.h             |  6 +--
 include/rtld-malloc.h              |  8 ++--
 locale/programs/locfile.h          |  2 +-
 nscd/nscd-client.h                 |  2 +-
 resolv/gai_misc.c                  |  2 +-
 rt/aio_misc.c                      |  2 +-
 sysdeps/nptl/gai_misc.h            |  4 +-
 sysdeps/unix/sysv/linux/aio_misc.h |  4 +-
 9 files changed, 56 insertions(+), 50 deletions(-)

-- 
2.32.0


             reply	other threads:[~2022-05-02 14:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 14:11 Nicholas Guriev [this message]
2022-05-02 12:08 ` [RFC PATCH v1 1/1] draft: Make non-optimized build possible Nicholas Guriev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1651500717.git.nicholas@guriev.su \
    --to=nicholas@guriev.su \
    --cc=libc-help@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).