[davidm@napali.hpl.hp.com: Re: [PATCH] i386 vsyscall DSO implementation]

H. J. Lu hjl@lucon.org
Sun Jun 15 05:07:00 GMT 2003


On Sat, Jun 14, 2003 at 09:41:11PM -0700, Jim Wilson wrote:
> On Sat, 2003-06-14 at 21:19, H. J. Lu wrote: 
> > Under what condition will the offset between 2 segments change? Even
> > with shared library, I don't think the offset between 2 segments
> > will change.
> 
> I dunno.  I'm not an expert with this stuff.  However, I do believe that
> there are systems that will load segments and then relocate them.  If
> this happens, there is no guarantee that offsets between segments will

I am not sure if it will work for ia64 because of GP.

> remain the same.  This will not work if you have segrel relocs that span
> segment boundaries, as your example does.  I doubt that this is a
> problem for linux though.
> 
> I did say it was a technicality.  If the linux kernel wants to rely on a
> feature that violates the IA-64 ABI, then that is certainly their
> choice.  We should at least mention the problem to them though.  It
> might be reasonable to fix the IA-64 ABI to allow this.  Or it might be
> reasonable to change the linux kernel so that it doesn't do this, and
> modify bfd to give an error for invalid segrel relocs like the one in
> your example.

Linux kernel never uses the pure ia64 psABI. How about we allow it for
constant GP and issue an error otherwise?

# make
/export/build/linux/binutils-debug/build-ia64-linux/ld/ld-new -o normal -Tt.lds
normal.o
/export/build/linux/binutils-debug/build-ia64-linux/ld/ld-new: normal.o:
unsupported SEGREL64LSB relocation in section `.IA_64.unwind' against section
`.text'
normal.o(.IA_64.unwind+0x0): unsupported reloc
/export/build/linux/binutils-debug/build-ia64-linux/ld/ld-new: normal.o:
unsupported SEGREL64LSB relocation in section `.IA_64.unwind' against section
`.text'
normal.o(.IA_64.unwind+0x8): unsupported reloc
/export/build/linux/binutils-debug/build-ia64-linux/ld/ld-new: normal.o:
unsupported SEGREL64LSB relocation in section `.IA_64.unwind' against section
`.IA_64.unwind_info'
normal.o(.IA_64.unwind+0x10): unsupported reloc
make: *** [normal] Error 1


H.J.
-------------- next part --------------
2003-06-14  H.J. Lu <hongjiu.lu@intel.com>

	* elfxx-ia64.c (elfNN_ia64_relocate_section): Support
	segment-relative relocation between different segments for
	constant GP.

--- bfd/elfxx-ia64.c.unwind	2003-06-13 08:34:09.000000000 -0700
+++ bfd/elfxx-ia64.c	2003-06-14 22:01:49.000000000 -0700
@@ -4317,6 +4317,22 @@ elfNN_ia64_relocate_section (output_bfd,
 	      struct elf_segment_map *m;
 	      Elf_Internal_Phdr *p;
 
+	      /* We support segment-relative relocations between
+		 different segments only if EF_IA_64_CONS_GP is set.  */
+	      if (elf_elfheader (input_bfd)->e_flags & EF_IA_64_CONS_GP)
+		sym_sec = input_section;
+	      else if (sym_sec->output_section
+		       != input_section->output_section)
+		{
+		  (*_bfd_error_handler)
+		    (_("%s: unsupported %s relocation in section `%s' against section `%s'"),
+		     bfd_archive_filename (input_bfd), howto->name,
+		     input_section->output_section->name,
+		     sym_sec->output_section->name);
+		  r = bfd_reloc_notsupported;
+		  break;
+		}
+
 	      /* Find the segment that contains the output_section.  */
 	      for (m = elf_tdata (output_bfd)->segment_map,
 		     p = elf_tdata (output_bfd)->phdr;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.tar.gz
Type: application/x-gzip
Size: 595 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20030615/56050236/attachment.bin>


More information about the Binutils mailing list