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]

copy_private_bfd_data in bfd/elf.c question


While porting gas and binutils to the HP-UX IA64 platform we were mostly
interested in gas but we also did some work to try and make sure that
the binutils tools (nm, objcopy, etc) worked and we have run into a
problem in copy_private_bfd_data in bfd/elf.c.

The problem centers around map->p_paddr.

copy_private_bfd_data has the following code:

              /* The Solaris native linker always sets p_paddr to 0.
                 We try to catch that case here, and set it to the
                 correct value.  */
              if (segment->p_paddr == 0
                  && segment->p_vaddr != 0
                  && isec == 0
                  && output_section->lma != 0
                  && (output_section->vma == (segment->p_vaddr
                                              + (map->includes_filehdr
                                                 ? iehdr->e_ehsize
                                                 : 0)
                                              + (map->includes_phdrs
                                                 ? (iehdr->e_phnum
                                                    * iehdr->e_phentsize)
                                                 : 0))))
                map->p_paddr = segment->p_vaddr;

Now, on IA64 HP-UX we found that the native linker (we didn't port gld)
also sets p_paddr to 0 and we were entering this if statement but doing
so caused us problems.  With this standard elf.c we found that running
objcopy and/or strip could result in objects that grew in size and/or
did a seg fault when we executed them.

Our current workaround is to comment out this code and then in the
following if statement where IS_CONTAINED_BY_LMA is checked to also
check IS_CONTAINED_BY_VMA and do the setting of map->sections if that is
true.

Unfortunately, I am not an elf expert and I don't know if the current
code or our changes can or should be considered correct and I don't know
how or if we can make the changes we want in a manner that won't affect
other platforms.  So I am looking for any advice people can offer on
what we should be doing and/or how it should be done.

Steve Ellcey
sje@cup.hp.com


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