* Re: ld bug? [not found] <1060095548.9686.69.camel@brick.watson.ibm.com> @ 2003-08-06 1:26 ` Alan Modra 0 siblings, 0 replies; 6+ messages in thread From: Alan Modra @ 2003-08-06 1:26 UTC (permalink / raw) To: Michal Ostrowski, binutils On Tue, Aug 05, 2003 at 10:59:09AM -0400, Michal Ostrowski wrote: > Hi, > > I have a bunch of object files that when linked together (to build > "troff") result in certain symbols being assigned the same location in > memory. > > This was achieved with gcc-3.2.3 (c++) and, > > powerpc64-linux-ld -v > GNU ld version 2.14.90 20030805 > > The problem is that we have a couple of symbols as follow: > > 84: 0000000020015c10 8 NOTYPE LOCAL DEFAULT 26 soft_hyphen_char > 2986: 0000000020015c18 8 NOTYPE GLOBAL DEFAULT 26 global_special_fonts > > > However, we also have (from .rela.dyn): > 000020015c10 004700000013 R_PPC_COPY 0000000020015c10 _ZTVN10__cxxabiv117__c + 0 > > This causes ld.so to copy 88 bytes of data to the location of > soft_hyphen_char (and the symbols that follow it). [snip] Hmm, yes. A ld map shows .bss 0x0000000010085b30 0x4248 *(.dynbss) *fill* 0x0000000010085b30 0x0 00 *(.bss .bss.* .gnu.linkonce.b.*) .bss 0x0000000010085b30 0x1 ./crtbegin.o *fill* 0x0000000010085b31 0x7 00 .bss 0x0000000010085b38 0xc8 ./env.o Note the zero .dynbss allocation. It should be 312 bytes in this case. The problem was uncoverd by this patch: 2003-07-10 Alan Modra <amodra@bigpond.net.au> (ppc64_elf_build_stubs): Check for stub sections in stub bfd by testing section flags. Fixed like this. * elflink.c (_bfd_elf_create_dynamic_sections): Mark .dynbss with SEC_LINKER_CREATED. Index: bfd/elflink.c =================================================================== RCS file: /cvs/src/src/bfd/elflink.c,v retrieving revision 1.42 diff -u -p -r1.42 elflink.c --- bfd/elflink.c 4 Aug 2003 09:39:46 -0000 1.42 +++ bfd/elflink.c 6 Aug 2003 01:22:35 -0000 @@ -309,7 +309,7 @@ _bfd_elf_create_dynamic_sections (bfd *a section into the .bss section of the final image. */ s = bfd_make_section (abfd, ".dynbss"); if (s == NULL - || ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) + || ! bfd_set_section_flags (abfd, s, SEC_ALLOC | SEC_LINKER_CREATED)) return FALSE; /* The .rel[a].bss section holds copy relocs. This section is not -- Alan Modra IBM OzLabs - Linux Technology Centre ^ permalink raw reply [flat|nested] 6+ messages in thread
* ld bug? @ 2001-10-29 14:35 Vassili Karpov 2001-10-30 23:30 ` H . J . Lu 0 siblings, 1 reply; 6+ messages in thread From: Vassili Karpov @ 2001-10-29 14:35 UTC (permalink / raw) To: binutils LD discards ELF visibility attributes when making relocateable objects. Example: a.s == .protected symbol b.s == dummy: --- as -o a.o a.s as -o b.o b.s ld -r -o c.o a.o b.o a.o: 4: 00000000 0 NOTYPE GLOBAL PROTECTED UND symbol c.o: 8: 00000000 0 NOTYPE GLOBAL DEFAULT UND symbol -- mailto:malc@pulsesoft.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ld bug? 2001-10-29 14:35 Vassili Karpov @ 2001-10-30 23:30 ` H . J . Lu 2001-10-30 23:33 ` H . J . Lu 0 siblings, 1 reply; 6+ messages in thread From: H . J . Lu @ 2001-10-30 23:30 UTC (permalink / raw) To: Vassili Karpov; +Cc: binutils On Tue, Oct 30, 2001 at 01:36:04AM +0300, Vassili Karpov wrote: > LD discards ELF visibility attributes when making relocateable objects. > > Example: > a.s > == > .protected symbol > > b.s > == > dummy: > --- > as -o a.o a.s > as -o b.o b.s > ld -r -o c.o a.o b.o > > a.o: 4: 00000000 0 NOTYPE GLOBAL PROTECTED UND symbol > c.o: 8: 00000000 0 NOTYPE GLOBAL DEFAULT UND symbol > -- It is ok since symbol is undefined. There is no such a thing as protected, undefined symbol. H.J. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ld bug? 2001-10-30 23:30 ` H . J . Lu @ 2001-10-30 23:33 ` H . J . Lu 2001-10-30 23:42 ` H . J . Lu 0 siblings, 1 reply; 6+ messages in thread From: H . J . Lu @ 2001-10-30 23:33 UTC (permalink / raw) To: Vassili Karpov; +Cc: binutils On Tue, Oct 30, 2001 at 11:30:13PM -0800, H . J . Lu wrote: > On Tue, Oct 30, 2001 at 01:36:04AM +0300, Vassili Karpov wrote: > > LD discards ELF visibility attributes when making relocateable objects. > > > > Example: > > a.s > > == > > .protected symbol > > > > b.s > > == > > dummy: > > --- > > as -o a.o a.s > > as -o b.o b.s > > ld -r -o c.o a.o b.o > > > > a.o: 4: 00000000 0 NOTYPE GLOBAL PROTECTED UND symbol > > c.o: 8: 00000000 0 NOTYPE GLOBAL DEFAULT UND symbol > > -- > > It is ok since symbol is undefined. There is no such a thing as > protected, undefined symbol. I take it back. It is a bug. I will fix it. H.J. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ld bug? 2001-10-30 23:33 ` H . J . Lu @ 2001-10-30 23:42 ` H . J . Lu 2001-10-31 6:27 ` Nick Clifton 0 siblings, 1 reply; 6+ messages in thread From: H . J . Lu @ 2001-10-30 23:42 UTC (permalink / raw) To: Vassili Karpov; +Cc: binutils On Tue, Oct 30, 2001 at 11:33:09PM -0800, H . J . Lu wrote: > On Tue, Oct 30, 2001 at 11:30:13PM -0800, H . J . Lu wrote: > > On Tue, Oct 30, 2001 at 01:36:04AM +0300, Vassili Karpov wrote: > > > LD discards ELF visibility attributes when making relocateable objects. > > > > > > Example: > > > a.s > > > == > > > .protected symbol > > > > > > b.s > > > == > > > dummy: > > > --- > > > as -o a.o a.s > > > as -o b.o b.s > > > ld -r -o c.o a.o b.o > > > > > > a.o: 4: 00000000 0 NOTYPE GLOBAL PROTECTED UND symbol > > > c.o: 8: 00000000 0 NOTYPE GLOBAL DEFAULT UND symbol > > > -- > > > > It is ok since symbol is undefined. There is no such a thing as > > protected, undefined symbol. > > I take it back. It is a bug. I will fix it. > > Here it is. H.J. --- 2001-10-30 H.J. Lu <hjl@gnu.org> * elflink.h (elf_link_output_extsym): Don't clear the visibility field for relocateable. Index: elflink.h =================================================================== RCS file: /work/cvs/gnu/binutils/bfd/elflink.h,v retrieving revision 1.87 diff -u -p -r1.87 elflink.h --- elflink.h 2001/10/28 17:38:27 1.87 +++ elflink.h 2001/10/31 07:40:35 @@ -5877,7 +5877,8 @@ elf_link_output_extsym (h, data) /* If a symbol is not defined locally, we clear the visibility field. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (! finfo->info->relocateable + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) sym.st_other ^= ELF_ST_VISIBILITY (sym.st_other); /* If this symbol should be put in the .dynsym section, then put it ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ld bug? 2001-10-30 23:42 ` H . J . Lu @ 2001-10-31 6:27 ` Nick Clifton 0 siblings, 0 replies; 6+ messages in thread From: Nick Clifton @ 2001-10-31 6:27 UTC (permalink / raw) To: H . J . Lu; +Cc: Vassili Karpov, binutils Hi H.J. > 2001-10-30 H.J. Lu <hjl@gnu.org> > > * elflink.h (elf_link_output_extsym): Don't clear the visibility > field for relocateable. Approved. Cheers Nick ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-08-06 1:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <1060095548.9686.69.camel@brick.watson.ibm.com> 2003-08-06 1:26 ` ld bug? Alan Modra 2001-10-29 14:35 Vassili Karpov 2001-10-30 23:30 ` H . J . Lu 2001-10-30 23:33 ` H . J . Lu 2001-10-30 23:42 ` H . J . Lu 2001-10-31 6:27 ` Nick Clifton
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).