public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "adhemerval.zanella at linaro dot org" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/29071] m68k: Removal of ELF_DURING_STARTUP optimization broke ld.so Date: Mon, 18 Apr 2022 11:39:03 +0000 [thread overview] Message-ID: <bug-29071-131-K1hvS5TWwO@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-29071-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=29071 --- Comment #5 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> --- We are(In reply to Fangrui Song from comment #4) > I think the issue is pre-existing. `elf: Assume disjointed .rela.dyn and > .rela.plt for loader` just tickled the compiler to generate the code which > breaks. > The m68k ld.so runs the following instructions in order. > > switch (r_type) # load jump table from GOT to fp. note the GOT entry > hasn't been relocated by a R_68K_RELATIVE below > 15738: 2c6d 08d4 moveal %a5@(2260),%fp > > *reloc_addr = l_addr + reloc->r_addend; # process relative relocations > 1576a: 2784 c800 movel %d4,%a3@(0000000000000000,%a4:l) > > switch (r_type) # load a value from the jump table > 157c8: 3c36 6800 movew %fp@(0000000000000000,%d6:l),%d6 We are most likely hitting a compiler bug here, unrolling the loops fixes the issue: diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h index 25dd7ca4f2..28cb25bdcd 100644 --- a/elf/dynamic-link.h +++ b/elf/dynamic-link.h @@ -114,13 +114,18 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], } \ } \ \ - for (int ranges_index = 0; ranges_index < 2; ++ranges_index) \ - elf_dynamic_do_##reloc ((map), scope, \ - ranges[ranges_index].start, \ - ranges[ranges_index].size, \ - ranges[ranges_index].nrelative, \ - ranges[ranges_index].lazy, \ - skip_ifunc); \ + elf_dynamic_do_##reloc ((map), scope, \ + ranges[0].start, \ + ranges[0].size, \ + ranges[0].nrelative, \ + ranges[0].lazy, \ + skip_ifunc); \ + elf_dynamic_do_##reloc ((map), scope, \ + ranges[1].start, \ + ranges[1].size, \ + ranges[1].nrelative, \ + ranges[1].lazy, \ + skip_ifunc); \ } while (0) # if ELF_MACHINE_NO_REL || ELF_MACHINE_NO_RELA It does increase the loader size, though. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2022-04-18 11:39 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-17 16:55 [Bug dynamic-link/29071] New: " chewi at gentoo dot org 2022-04-17 16:59 ` [Bug dynamic-link/29071] " dilfridge at gentoo dot org 2022-04-17 17:06 ` dilfridge at gentoo dot org 2022-04-17 18:54 ` i at maskray dot me 2022-04-17 20:52 ` i at maskray dot me 2022-04-18 2:09 ` i at maskray dot me 2022-04-18 11:39 ` adhemerval.zanella at linaro dot org [this message] 2022-04-18 12:21 ` schwab@linux-m68k.org 2022-04-18 14:18 ` schwab@linux-m68k.org 2022-04-18 15:14 ` schwab@linux-m68k.org 2022-04-18 15:57 ` i at maskray dot me 2022-04-18 21:52 ` chewi at gentoo dot org 2022-04-20 21:57 ` i at maskray dot me 2022-04-20 21:59 ` chewi at gentoo dot org 2022-04-21 7:58 ` fweimer at redhat dot com
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=bug-29071-131-K1hvS5TWwO@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@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: linkBe 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).