This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Non-SHF_ALLOC sections on Alpha very broken


Hi!

With the previous patch applied, strip finally doesn't die on
Alpha, but the content of non-alloced .rela.debug* sections is
broken anyway. Particularly either all or most of the relocs in
those sections are R_ALPHA_NONE (e.g. quite small library
libthread_db.so with only 0x2330 bytes of .text and way less bytes
.data/.bss has 0x8b883 bytes long .debug_info and 0x11a198 bytes
long .rela.debug_info containing only zeros).
As I don't know which exact relocs you want to keep, I haven't started
working on a patch.
The problem is that NEED_DYNREL is set even for non-dynamic relocs in
non-allocated sections, while elf64_alpha_relocate_section only emits
them for dynamic relocations:
            if (dynamic_symbol_p)
              {
                BFD_ASSERT(h->root.dynindx != -1);
                outrel.r_info = ELF64_R_INFO (h->root.dynindx, r_type);
                outrel.r_addend = addend;
                addend = 0, value = 0;
              }
            else if (r_type == R_ALPHA_DTPREL64)
              {
                BFD_ASSERT(tls_segment != NULL);
                value -= dtp_base;
                goto default_reloc;
              }
            else if (r_type == R_ALPHA_TPREL64)
              {
                BFD_ASSERT(tls_segment != NULL);
                value -= dtp_base;
                goto default_reloc;
              }
            else if (info->shared
                     && r_symndx != 0
                     && (input_section->flags & SEC_ALLOC))
              {
                if (r_type == R_ALPHA_REFLONG)
                  {
                    (*_bfd_error_handler)
                      (_("%s: unhandled dynamic relocation against %s"),
                       bfd_archive_filename (input_bfd),
                       h->root.root.root.string);
                    ret_val = false;
                  }
                outrel.r_info = ELF64_R_INFO (0, R_ALPHA_RELATIVE);
                outrel.r_addend = value;
              }
            else
              goto default_reloc;

I hope it is the NEED_DYNREL which should be changed, not relocate_section,
or at least not all non-dynamic .debug_info relocs need to be copied,
like relocs into .debug_str section.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]