* i386-pc-nto-qnx patch
@ 2002-04-17 13:05 Graeme Peterson
2002-04-17 20:18 ` Alan Modra
2002-04-19 10:43 ` J.T. Conklin
0 siblings, 2 replies; 18+ messages in thread
From: Graeme Peterson @ 2002-04-17 13:05 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 863 bytes --]
Hi, all.
Here is a patch for i386-pc-nto-qnx for inclusion in
GNU binutils. Thanks to all for your help.
I have followed Daniel Jacobowitz' suggestion regarding
including bfd/elf32-i386.c in the new bfd/elf32-i386qnx.c
to facilitate adding our own elf backend.
A couple of areas to point out for your consideration:
- bfd/elf.c _bfd_elf_copy_private_section_data()
I have some code that I have flagged with a FIXME.
- ld/emultempl/elf32.em
I have a #if 0 with a comment. This is so you can see
why I think the code should be removed in the general case
for everyone, and then we can comment on the correctness
or lack thereof.
The new backend function is elf_backend_set_nonloadable_filepos().
I have been on a learning curve, and it turns out the PT_SEGREL
that I thought was loadable is not.
Thanks.
Looking forward to any feedback.
GP
[-- Attachment #2: 'diff' output text --]
[-- Type: text/plain, Size: 21733 bytes --]
diff -rc3p -N src.orig/bfd/Makefile.am src/bfd/Makefile.am
*** src.orig/bfd/Makefile.am Thu Apr 4 09:04:38 2002
--- src/bfd/Makefile.am Thu Apr 4 16:58:35 2002
*************** BFD32_BACKENDS = \
*** 202,207 ****
--- 202,208 ----
elf32-hppa.lo \
elf32-i370.lo \
elf32-i386.lo \
+ elf32-i386qnx.lo \
elf32-i860.lo \
elf32-i960.lo \
elf32-ia64.lo \
*************** BFD32_BACKENDS_CFILES = \
*** 351,356 ****
--- 352,358 ----
elf32-hppa.c \
elf32-i370.c \
elf32-i386.c \
+ elf32-i386qnx.c \
elf32-i860.c \
elf32-i960.c \
elf32-m32r.c \
*************** elf32-i370.lo: elf32-i370.c $(INCDIR)/fi
*** 1079,1084 ****
--- 1081,1090 ----
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h
elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
+ elf32-i386qnx.lo: elf32-i386qnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
diff -rc3p -N src.orig/bfd/Makefile.in src/bfd/Makefile.in
*** src.orig/bfd/Makefile.in Thu Apr 4 09:04:38 2002
--- src/bfd/Makefile.in Thu Apr 4 16:58:35 2002
*************** BFD32_BACKENDS = \
*** 330,335 ****
--- 330,336 ----
elf32-hppa.lo \
elf32-i370.lo \
elf32-i386.lo \
+ elf32-i386qnx.lo \
elf32-i860.lo \
elf32-i960.lo \
elf32-ia64.lo \
*************** BFD32_BACKENDS_CFILES = \
*** 480,485 ****
--- 481,487 ----
elf32-hppa.c \
elf32-i370.c \
elf32-i386.c \
+ elf32-i386qnx.c \
elf32-i860.c \
elf32-i960.c \
elf32-m32r.c \
*************** elf32-i370.lo: elf32-i370.c $(INCDIR)/fi
*** 1623,1628 ****
--- 1625,1634 ----
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h
elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
+ elf32-i386qnx.lo: elf32-i386qnx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
diff -rc3p -N src.orig/bfd/config.bfd src/bfd/config.bfd
*** src.orig/bfd/config.bfd Mon Mar 18 07:45:37 2002
--- src/bfd/config.bfd Mon Mar 25 14:29:14 2002
*************** case "${targ}" in
*** 336,341 ****
--- 336,345 ----
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
+ i[3456]86-*-nto-qnx*)
+ targ_defvec=bfd_elf32_i386qnx_vec
+ targ_selvecs=i386coff_vec
+ ;;
i[3456]86-*-chorus*)
targ_defvec=bfd_elf32_i386_vec
;;
diff -rc3p -N src.orig/bfd/configure src/bfd/configure
*** src.orig/bfd/configure Sun Apr 7 17:49:08 2002
--- src/bfd/configure Tue Apr 9 17:43:01 2002
*************** do
*** 6005,6010 ****
--- 6005,6011 ----
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
+ bfd_elf32_i386qnx_vec) tb="$tb elf32-i386qnx.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
diff -rc3p -N src.orig/bfd/configure.in src/bfd/configure.in
*** src.orig/bfd/configure.in Sun Apr 7 17:49:09 2002
--- src/bfd/configure.in Tue Apr 9 17:43:01 2002
*************** do
*** 562,567 ****
--- 562,568 ----
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
+ bfd_elf32_i386qnx_vec) tb="$tb elf32-i386qnx.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
diff -rc3p -N src.orig/bfd/elf-bfd.h src/bfd/elf-bfd.h
*** src.orig/bfd/elf-bfd.h Thu Apr 4 02:01:19 2002
--- src/bfd/elf-bfd.h Thu Apr 4 17:47:02 2002
*************** struct elf_backend_data
*** 748,753 ****
--- 748,758 ----
boolean (*elf_backend_write_section)
PARAMS ((bfd *, asection *, bfd_byte *));
+ /* This function, if defined, sets up the file positions for non PT_LOAD
+ segments, especially for segments containing non-allocated sections. */
+ void (*elf_backend_set_nonloadable_filepos)
+ PARAMS ((bfd *, Elf_Internal_Phdr *));
+
/* The level of IRIX compatibility we're striving for.
MIPS ELF specific function. */
irix_compat_t (*elf_backend_mips_irix_compat)
diff -rc3p -N src.orig/bfd/elf.c src/bfd/elf.c
*** src.orig/bfd/elf.c Thu Apr 11 23:30:56 2002
--- src/bfd/elf.c Wed Apr 17 15:48:24 2002
*************** Error: First section in segment (%s) sta
*** 3649,3654 ****
--- 3649,3659 ----
}
}
+ /* If additional nonloadable filepos adjustments are required,
+ do them now. */
+ if (bed->elf_backend_set_nonloadable_filepos)
+ bed->elf_backend_set_nonloadable_filepos(abfd, phdrs);
+
/* Clear out any program headers we allocated but did not use. */
for (; count < alloc; count++, p++)
{
*************** copy_private_bfd_data (ibfd, obfd)
*** 4232,4237 ****
--- 4237,4249 ----
&& (section->lma + section->_raw_size) \
<= SEGMENT_END (segment, base))
+ /* Returns true if the given section is contained within
+ the given segment. Filepos addresses are compared. */
+ #define IS_CONTAINED_BY_FILEPOS(section, segment) \
+ ((unsigned) section->filepos >= segment->p_offset \
+ && ((unsigned) section->filepos + section->_raw_size) \
+ <= SEGMENT_END (segment, segment->p_offset))
+
/* Special case: corefile "NOTE" section containing regs, prpsinfo etc. */
#define IS_COREFILE_NOTE(p, s) \
(p->p_type == PT_NOTE \
*************** copy_private_bfd_data (ibfd, obfd)
*** 4266,4272 ****
: IS_CONTAINED_BY_VMA (section, segment)) \
|| IS_SOLARIS_PT_INTERP (segment, section)) \
&& (section->flags & SEC_ALLOC) != 0) \
! || IS_COREFILE_NOTE (segment, section)) \
&& section->output_section != NULL \
&& section->segment_mark == false)
--- 4278,4286 ----
: IS_CONTAINED_BY_VMA (section, segment)) \
|| IS_SOLARIS_PT_INTERP (segment, section)) \
&& (section->flags & SEC_ALLOC) != 0) \
! || IS_COREFILE_NOTE (segment, section) \
! || (IS_CONTAINED_BY_FILEPOS (section, segment) \
! && (section->flags & SEC_ALLOC) == 0)) \
&& section->output_section != NULL \
&& section->segment_mark == false)
*************** copy_private_bfd_data (ibfd, obfd)
*** 4278,4284 ****
#define SEGMENT_OVERLAPS(seg1, seg2) \
(!(SEGMENT_AFTER_SEGMENT (seg1, seg2) || SEGMENT_AFTER_SEGMENT (seg2, seg1)))
- /* Initialise the segment mark field. */
for (section = ibfd->sections; section != NULL; section = section->next)
section->segment_mark = false;
--- 4292,4297 ----
*************** copy_private_bfd_data (ibfd, obfd)
*** 4495,4500 ****
--- 4508,4514 ----
/* Match up the physical address of the segment with the
LMA address of the output section. */
if (IS_CONTAINED_BY_LMA (output_section, segment, map->p_paddr)
+ || IS_CONTAINED_BY_FILEPOS (section, segment)
|| IS_COREFILE_NOTE (segment, section))
{
if (matching_lma == 0)
*************** copy_private_bfd_data (ibfd, obfd)
*** 4564,4570 ****
}
/* Step Three: Loop over the sections again, this time assigning
! those that fit to the current segment and remvoing them from the
sections array; but making sure not to leave large gaps. Once all
possible sections have been assigned to the current segment it is
added to the list of built segments and if sections still remain
--- 4578,4584 ----
}
/* Step Three: Loop over the sections again, this time assigning
! those that fit to the current segment and removing them from the
sections array; but making sure not to leave large gaps. Once all
possible sections have been assigned to the current segment it is
added to the list of built segments and if sections still remain
*************** copy_private_bfd_data (ibfd, obfd)
*** 4728,4733 ****
--- 4742,4748 ----
#undef SEGMENT_END
#undef IS_CONTAINED_BY_VMA
#undef IS_CONTAINED_BY_LMA
+ #undef IS_CONTAINED_BY_FILEPOS
#undef IS_COREFILE_NOTE
#undef IS_SOLARIS_PT_INTERP
#undef INCLUDE_SECTION_IN_SEGMENT
*************** _bfd_elf_copy_private_section_data (ibfd
*** 4747,4752 ****
--- 4762,4768 ----
asection *osec;
{
Elf_Internal_Shdr *ihdr, *ohdr;
+ const struct elf_backend_data *bed = get_elf_backend_data (ibfd);
if (ibfd->xvec->flavour != bfd_target_elf_flavour
|| obfd->xvec->flavour != bfd_target_elf_flavour)
*************** _bfd_elf_copy_private_section_data (ibfd
*** 4760,4779 ****
if (elf_tdata (obfd)->segment_map == NULL
&& elf_tdata (ibfd)->phdr != NULL)
{
! asection *s;
!
! /* Only set up the segments if there are no more SEC_ALLOC
! sections. FIXME: This won't do the right thing if objcopy is
! used to remove the last SEC_ALLOC section, since objcopy
! won't call this routine in that case. */
! for (s = isec->next; s != NULL; s = s->next)
! if ((s->flags & SEC_ALLOC) != 0)
! break;
! if (s == NULL)
{
! if (! copy_private_bfd_data (ibfd, obfd))
! return false;
}
}
ihdr = &elf_section_data (isec)->this_hdr;
--- 4776,4812 ----
if (elf_tdata (obfd)->segment_map == NULL
&& elf_tdata (ibfd)->phdr != NULL)
{
! /* If we have elf_backend_set_nonloadable_filepos function,
! don't check against SEC_ALLOC, as we want to set up the
! segments anyways.
! FIXME - this is currently only defined for QNX, and if
! anyone else defines this function, they may not want this
! behavior. */
! if (bed->elf_backend_set_nonloadable_filepos)
{
! if (isec->next == NULL)
! {
! if (! copy_private_bfd_data (ibfd, obfd))
! return false;
! }
}
+ else
+ {
+ asection *s;
+
+ /* Only set up the segments if there are no more SEC_ALLOC
+ sections. FIXME: This won't do the right thing if objcopy is
+ used to remove the last SEC_ALLOC section, since objcopy
+ won't call this routine in that case. */
+ for (s = isec->next; s != NULL; s = s->next)
+ if ((s->flags & SEC_ALLOC) != 0)
+ break;
+ if (s == NULL)
+ {
+ if (! copy_private_bfd_data (ibfd, obfd))
+ return false;
+ }
+ }
}
ihdr = &elf_section_data (isec)->this_hdr;
diff -rc3p -N src.orig/bfd/elf32-i386.c src/bfd/elf32-i386.c
*** src.orig/bfd/elf32-i386.c Thu Apr 4 14:53:36 2002
--- src/bfd/elf32-i386.c Thu Apr 4 16:58:43 2002
*************** elf_i386_finish_dynamic_sections (output
*** 2466,2469 ****
--- 2466,2471 ----
#define elf_backend_relocate_section elf_i386_relocate_section
#define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections
+ #ifndef ELF32_I386_C_INCLUDED
#include "elf32-target.h"
+ #endif
diff -rc3p -N src.orig/bfd/elf32-i386qnx.c src/bfd/elf32-i386qnx.c
*** src.orig/bfd/elf32-i386qnx.c Wed Dec 31 19:00:00 1969
--- src/bfd/elf32-i386qnx.c Wed Apr 17 15:48:44 2002
***************
*** 0 ****
--- 1,76 ----
+ /* Intel 80386/80486 QNX specific support for 32-bit ELF
+ Copyright 2002
+ Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+ #define ELF32_I386_C_INCLUDED
+ #include "elf32-i386.c"
+
+ static void elf_i386qnx_set_nonloadable_filepos
+ PARAMS ((bfd *, Elf_Internal_Phdr *));
+
+ static void
+ elf_i386qnx_set_nonloadable_filepos(abfd, phdrs)
+ bfd *abfd;
+ Elf_Internal_Phdr *phdrs;
+ {
+ struct elf_segment_map *m;
+ Elf_Internal_Phdr *p;
+ file_ptr off = 0;
+
+ for (m = elf_tdata (abfd)->segment_map, p = phdrs;
+ m != NULL;
+ m = m->next, p++)
+ {
+ unsigned int i;
+ asection **secpp;
+
+ for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
+ {
+ asection *sec;
+
+ sec = *secpp;
+
+ if (p->p_type == PT_LOAD)
+ off = sec->filepos;
+ else
+ {
+ if (i == 0)
+ {
+ if (sec->filepos)
+ p->p_offset = sec->filepos;
+ else
+ p->p_offset = off;
+ }
+ if (!sec->filepos)
+ {
+ off += sec->_raw_size;
+ p->p_filesz += sec->_raw_size;
+ }
+ }
+ }
+ }
+ return;
+ }
+
+ #undef TARGET_LITTLE_SYM
+ #define TARGET_LITTLE_SYM bfd_elf32_i386qnx_vec
+
+ #define elf_backend_set_nonloadable_filepos elf_i386qnx_set_nonloadable_filepos
+
+ #include "elf32-target.h"
diff -rc3p -N src.orig/bfd/elfxx-target.h src/bfd/elfxx-target.h
*** src.orig/bfd/elfxx-target.h Thu Apr 4 14:53:37 2002
--- src/bfd/elfxx-target.h Thu Apr 4 17:44:48 2002
*************** Foundation, Inc., 59 Temple Place - Suit
*** 371,376 ****
--- 371,379 ----
#ifndef elf_backend_write_section
#define elf_backend_write_section NULL
#endif
+ #ifndef elf_backend_set_nonloadable_filepos
+ #define elf_backend_set_nonloadable_filepos NULL
+ #endif
#ifndef elf_backend_mips_irix_compat
#define elf_backend_mips_irix_compat NULL
#endif
*************** static const struct elf_backend_data elf
*** 468,473 ****
--- 471,477 ----
elf_backend_discard_info,
elf_backend_ignore_discarded_relocs,
elf_backend_write_section,
+ elf_backend_set_nonloadable_filepos,
elf_backend_mips_irix_compat,
elf_backend_mips_rtype_to_howto,
elf_backend_ecoff_debug_swap,
Binary files src.orig/bfd/po/es.gmo and src/bfd/po/es.gmo differ
Binary files src.orig/bfd/po/fr.gmo and src/bfd/po/fr.gmo differ
Binary files src.orig/bfd/po/ja.gmo and src/bfd/po/ja.gmo differ
Binary files src.orig/bfd/po/sv.gmo and src/bfd/po/sv.gmo differ
Binary files src.orig/bfd/po/tr.gmo and src/bfd/po/tr.gmo differ
diff -rc3p -N src.orig/bfd/targets.c src/bfd/targets.c
*** src.orig/bfd/targets.c Thu Apr 4 14:53:38 2002
--- src/bfd/targets.c Thu Apr 4 16:59:20 2002
*************** extern const bfd_target bfd_elf32_hppa_l
*** 509,514 ****
--- 509,515 ----
extern const bfd_target bfd_elf32_hppa_vec;
extern const bfd_target bfd_elf32_i370_vec;
extern const bfd_target bfd_elf32_i386_vec;
+ extern const bfd_target bfd_elf32_i386qnx_vec;
extern const bfd_target bfd_elf32_i860_little_vec;
extern const bfd_target bfd_elf32_i860_vec;
extern const bfd_target bfd_elf32_i960_vec;
*************** static const bfd_target * const _bfd_tar
*** 759,764 ****
--- 760,766 ----
&bfd_elf32_hppa_vec,
&bfd_elf32_i370_vec,
&bfd_elf32_i386_vec,
+ &bfd_elf32_i386qnx_vec,
&bfd_elf32_i860_little_vec,
&bfd_elf32_i860_vec,
&bfd_elf32_i960_vec,
Binary files src.orig/binutils/po/es.gmo and src/binutils/po/es.gmo differ
Binary files src.orig/binutils/po/fr.gmo and src/binutils/po/fr.gmo differ
Binary files src.orig/binutils/po/ja.gmo and src/binutils/po/ja.gmo differ
Binary files src.orig/binutils/po/tr.gmo and src/binutils/po/tr.gmo differ
diff -rc3p -N src.orig/gas/configure src/gas/configure
*** src.orig/gas/configure Mon Mar 18 07:46:06 2002
--- src/gas/configure Tue Apr 16 15:36:05 2002
*************** EOF
*** 2451,2456 ****
--- 2451,2457 ----
i386-*-cygwin*) fmt=coff em=pe bfd_gas=yes ;;
i386-*-interix*) fmt=coff em=interix bfd_gas=yes ;;
i386-*-mingw32*) fmt=coff em=pe bfd_gas=yes ;;
+ i386-*-nto*) fmt=elf ;;
i386-*-*nt*) fmt=coff em=pe bfd_gas=yes ;;
i386-*-vxworks*) fmt=aout ;;
i386-*-chaos) fmt=elf ;;
diff -rc3p -N src.orig/gas/configure.in src/gas/configure.in
*** src.orig/gas/configure.in Mon Mar 18 07:46:09 2002
--- src/gas/configure.in Tue Apr 16 15:36:21 2002
*************** changequote([,])dnl
*** 298,303 ****
--- 298,304 ----
i386-*-cygwin*) fmt=coff em=pe bfd_gas=yes ;;
i386-*-interix*) fmt=coff em=interix bfd_gas=yes ;;
i386-*-mingw32*) fmt=coff em=pe bfd_gas=yes ;;
+ i386-*-nto*) fmt=elf ;;
i386-*-*nt*) fmt=coff em=pe bfd_gas=yes ;;
i386-*-vxworks*) fmt=aout ;;
i386-*-chaos) fmt=elf ;;
Binary files src.orig/gas/po/es.gmo and src/gas/po/es.gmo differ
Binary files src.orig/gas/po/fr.gmo and src/gas/po/fr.gmo differ
Binary files src.orig/gas/po/tr.gmo and src/gas/po/tr.gmo differ
Binary files src.orig/gprof/po/es.gmo and src/gprof/po/es.gmo differ
Binary files src.orig/gprof/po/fr.gmo and src/gprof/po/fr.gmo differ
Binary files src.orig/gprof/po/sv.gmo and src/gprof/po/sv.gmo differ
Binary files src.orig/gprof/po/tr.gmo and src/gprof/po/tr.gmo differ
diff -rc3p -N src.orig/ld/Makefile.in src/ld/Makefile.in
*** src.orig/ld/Makefile.in Thu Apr 4 09:07:57 2002
--- src/ld/Makefile.in Thu Apr 4 16:59:35 2002
*************** ez8001.c: $(srcdir)/emulparams/z8001.sh
*** 1706,1711 ****
--- 1706,1714 ----
ez8002.c: $(srcdir)/emulparams/z8002.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS}
${GENSCRIPTS} z8002 "$(tdir_z8002)"
+ ei386nto.c: $(srcdir)/emulparams/i386nto.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} i386nto "$(tdir_i386nto)"
# The generated emulation files mostly have the same dependencies.
$(EMULATION_OFILES): ../bfd/bfd.h sysdep.h config.h $(INCDIR)/bfdlink.h \
diff -rc3p -N src.orig/ld/configure.tgt src/ld/configure.tgt
*** src.orig/ld/configure.tgt Mon Mar 18 11:42:42 2002
--- src/ld/configure.tgt Thu Mar 21 10:43:28 2002
*************** m68*-ericsson-ose) targ_emul=sun3 ;;
*** 118,123 ****
--- 118,124 ----
m68*-apple-aux*) targ_emul=m68kaux ;;
*-tandem-none) targ_emul=st2000 ;;
i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;;
+ i[3456]86-*-nto*) targ_emul=i386nto ;;
i[3456]86-*-vsta) targ_emul=vsta ;;
i[3456]86-go32-rtems*) targ_emul=i386go32 ;;
i[3456]86-*-go32) targ_emul=i386go32 ;;
diff -rc3p -N src.orig/ld/emulparams/i386nto.sh src/ld/emulparams/i386nto.sh
*** src.orig/ld/emulparams/i386nto.sh Wed Dec 31 19:00:00 1969
--- src/ld/emulparams/i386nto.sh Thu Mar 21 14:25:08 2002
***************
*** 0 ****
--- 1,12 ----
+ SCRIPT_NAME=elf
+ OUTPUT_FORMAT="elf32-i386"
+ TEXT_START_ADDR=0x08048000
+ TEXT_START_SYMBOLS='_btext = .;'
+ MAXPAGESIZE=0x1000
+ NONPAGED_TEXT_START_ADDR=0x08048000
+ #SHLIB_TEXT_START_ADDR=0xb0300000
+ ARCH=i386
+ MACHINE=
+ NOP=0x9090
+ TEMPLATE_NAME=elf32
+ GENERATE_SHLIB_SCRIPT=yes
diff -rc3p -N src.orig/ld/emultempl/elf32.em src/ld/emultempl/elf32.em
*** src.orig/ld/emultempl/elf32.em Tue Mar 19 16:03:43 2002
--- src/ld/emultempl/elf32.em Mon Mar 25 10:45:35 2002
*************** cat >>e${EMULATION_NAME}.c <<EOF
*** 695,702 ****
--- 695,709 ----
{
char *filename;
+ #if 0
+ /* This was removed to allow the linker to search in library
+ paths supplied at the command-line when looking for libs that
+ are in DT_NEEDED sections of shared libraries.
+ GP March 25, 2002 */
+
if (search->cmdline)
continue;
+ #endif
filename = (char *) xmalloc (strlen (search->name) + len + 2);
sprintf (filename, "%s/%s", search->name, l->name);
if (gld${EMULATION_NAME}_try_needed (filename, force))
Binary files src.orig/ld/po/es.gmo and src/ld/po/es.gmo differ
Binary files src.orig/ld/po/fr.gmo and src/ld/po/fr.gmo differ
Binary files src.orig/ld/po/sv.gmo and src/ld/po/sv.gmo differ
Binary files src.orig/ld/po/tr.gmo and src/ld/po/tr.gmo differ
Binary files src.orig/opcodes/po/da.gmo and src/opcodes/po/da.gmo differ
Binary files src.orig/opcodes/po/de.gmo and src/opcodes/po/de.gmo differ
Binary files src.orig/opcodes/po/es.gmo and src/opcodes/po/es.gmo differ
Binary files src.orig/opcodes/po/fr.gmo and src/opcodes/po/fr.gmo differ
Binary files src.orig/opcodes/po/sv.gmo and src/opcodes/po/sv.gmo differ
Binary files src.orig/opcodes/po/tr.gmo and src/opcodes/po/tr.gmo differ
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-04-17 13:05 i386-pc-nto-qnx patch Graeme Peterson
@ 2002-04-17 20:18 ` Alan Modra
2002-04-18 7:38 ` Graeme Peterson
2002-04-19 10:43 ` J.T. Conklin
1 sibling, 1 reply; 18+ messages in thread
From: Alan Modra @ 2002-04-17 20:18 UTC (permalink / raw)
To: Graeme Peterson; +Cc: binutils
I'll review the rest later, just addressing this particular point here.
On Wed, Apr 17, 2002 at 04:05:10PM -0400, Graeme Peterson wrote:
> - ld/emultempl/elf32.em
> I have a #if 0 with a comment. This is so you can see
> why I think the code should be removed in the general case
> for everyone, and then we can comment on the correctness
> or lack thereof.
> + #if 0
> + /* This was removed to allow the linker to search in library
> + paths supplied at the command-line when looking for libs that
> + are in DT_NEEDED sections of shared libraries.
> + GP March 25, 2002 */
> +
> if (search->cmdline)
> continue;
> + #endif
Did you read the following comment?
/* We need to find this file and include the symbol table. We
want to search for the file in the same way that the dynamic
linker will search. That means that we want to use
rpath_link, rpath, then the environment variable
LD_LIBRARY_PATH (native only), then the DT_RPATH/DT_RUNPATH
entries (native only), then the linker script LIB_SEARCH_DIRS.
We do not search using the -L arguments.
We search twice. The first time, we skip objects which may
introduce version mismatches. The second time, we force
their use. See gld${EMULATION_NAME}_vercheck comment. */
Particularly the phrase "same way that the dynamic linker will search".
That's why -L shouldn't change the search path for shared libraries.
If you really want to do something weird with shared lib search paths,
you should be using -rpath-link (which affects just the linker), or
-rpath (which affects linker and dynamic linker).
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-04-17 20:18 ` Alan Modra
@ 2002-04-18 7:38 ` Graeme Peterson
2002-04-18 9:58 ` H . J . Lu
0 siblings, 1 reply; 18+ messages in thread
From: Graeme Peterson @ 2002-04-18 7:38 UTC (permalink / raw)
To: Alan Modra; +Cc: binutils
Thanks, Alan.
I don't think that the way you are suggesting we do it matches
well with our cross development setup, since the shared libraries
are not in the same place on the target. I'll have to check and
verify, though.
Also, the reason that we initially had this done was because we were
linking against shared libs in a staging area, but the DT_NEEDED
dependecies were not looking there, causing all sorts of symbol problems
since they were linking against the outdated installed versions.
However, this is mostly an internal thing, so I am happy to just leave
that part out of the patch. Should I re-create a patch without that
#if 0 and #endif? Or is it small enough to just be omitted?
Thanks again.
Regards,
GP
>
> I'll review the rest later, just addressing this particular point here.
>
> On Wed, Apr 17, 2002 at 04:05:10PM -0400, Graeme Peterson wrote:
> > - ld/emultempl/elf32.em
> > I have a #if 0 with a comment. This is so you can see
> > why I think the code should be removed in the general case
> > for everyone, and then we can comment on the correctness
> > or lack thereof.
>
> > + #if 0
> > + /* This was removed to allow the linker to search in library
> > + paths supplied at the command-line when looking for libs that
> > + are in DT_NEEDED sections of shared libraries.
> > + GP March 25, 2002 */
> > +
> > if (search->cmdline)
> > continue;
> > + #endif
>
> Did you read the following comment?
>
> /* We need to find this file and include the symbol table. We
> want to search for the file in the same way that the dynamic
> linker will search. That means that we want to use
> rpath_link, rpath, then the environment variable
> LD_LIBRARY_PATH (native only), then the DT_RPATH/DT_RUNPATH
> entries (native only), then the linker script LIB_SEARCH_DIRS.
> We do not search using the -L arguments.
>
> We search twice. The first time, we skip objects which may
> introduce version mismatches. The second time, we force
> their use. See gld${EMULATION_NAME}_vercheck comment. */
>
> Particularly the phrase "same way that the dynamic linker will search".
> That's why -L shouldn't change the search path for shared libraries.
> If you really want to do something weird with shared lib search paths,
> you should be using -rpath-link (which affects just the linker), or
> -rpath (which affects linker and dynamic linker).
>
> --
> Alan Modra
> IBM OzLabs - Linux Technology Centre
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-04-18 7:38 ` Graeme Peterson
@ 2002-04-18 9:58 ` H . J . Lu
2002-04-18 10:54 ` Graeme Peterson
0 siblings, 1 reply; 18+ messages in thread
From: H . J . Lu @ 2002-04-18 9:58 UTC (permalink / raw)
To: Graeme Peterson; +Cc: Alan Modra, binutils
On Thu, Apr 18, 2002 at 10:38:16AM -0400, Graeme Peterson wrote:
> Thanks, Alan.
>
> I don't think that the way you are suggesting we do it matches
> well with our cross development setup, since the shared libraries
> are not in the same place on the target. I'll have to check and
> verify, though.
>
We cross compile all our binaries. The build machine has nothing in
common with our target. -rpath-link works fine for us.
H.J.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-04-18 9:58 ` H . J . Lu
@ 2002-04-18 10:54 ` Graeme Peterson
0 siblings, 0 replies; 18+ messages in thread
From: Graeme Peterson @ 2002-04-18 10:54 UTC (permalink / raw)
To: H . J . Lu; +Cc: Alan Modra, binutils
>
> On Thu, Apr 18, 2002 at 10:38:16AM -0400, Graeme Peterson wrote:
> > Thanks, Alan.
> >
> > I don't think that the way you are suggesting we do it matches
> > well with our cross development setup, since the shared libraries
> > are not in the same place on the target. I'll have to check and
> > verify, though.
> >
>
> We cross compile all our binaries. The build machine has nothing in
> common with our target. -rpath-link works fine for us.
Good to know. As I said, I'm happy to leave it out, and when I have time
I will revisit the issue, and certainly give -rpath-link a go.
Thanks.
GP
>
>
> H.J.
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-04-17 13:05 i386-pc-nto-qnx patch Graeme Peterson
2002-04-17 20:18 ` Alan Modra
@ 2002-04-19 10:43 ` J.T. Conklin
2002-04-19 17:01 ` Graeme Peterson
2002-04-19 17:48 ` Graeme Peterson
1 sibling, 2 replies; 18+ messages in thread
From: J.T. Conklin @ 2002-04-19 10:43 UTC (permalink / raw)
To: Graeme Peterson; +Cc: binutils
"Graeme Peterson" <gp@qnx.com> writes:
> Here is a patch for i386-pc-nto-qnx for inclusion in
> GNU binutils. Thanks to all for your help.
> Thanks.
> Looking forward to any feedback.
You'll need ChangeLog entries for all these changes.
Aside from the BFD changes, these changes are similar to the binutils
port I recently submitted. However, I think linker configuration is
superior in my port. Mine has emulparms/elf_i386_qnx.sh inheriting
from elf_i386.sh and elf_qnx.sh, eliminating duplicate definitions and
setting things up so that definitions common to all QNX ports can live
in one place.
Since then, I've split it into elf_qnx60.sh and elf_qnx61.sh, as the
ELF interpreter is different in 6.0 and 6.1. I think it's marginally
better to set the interpreter in the linker, since that allows the
same gcc config to target both versions of the OS. At least this is
true with my gcc port.
The config triple is i[3456]86-*-nto-qnx* in bfd, and i[3456]86-*-nto*
in gas and ld. These should probably be consistant. I'd recommend the
latter, especially if/when we have to distinguish between versions as
the master config.guess will return a pattern like i386-pc-nto-qnx6.10.
--jtc
--
J.T. Conklin
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-04-19 10:43 ` J.T. Conklin
@ 2002-04-19 17:01 ` Graeme Peterson
2002-04-19 17:48 ` Graeme Peterson
1 sibling, 0 replies; 18+ messages in thread
From: Graeme Peterson @ 2002-04-19 17:01 UTC (permalink / raw)
To: jtc; +Cc: binutils
>
> "Graeme Peterson" <gp@qnx.com> writes:
> > Here is a patch for i386-pc-nto-qnx for inclusion in
> > GNU binutils. Thanks to all for your help.
>
> > Thanks.
> > Looking forward to any feedback.
>
> You'll need ChangeLog entries for all these changes.
Mmm. Wondered about that. I'll look for info on format, etc...
>
> Aside from the BFD changes, these changes are similar to the binutils
> port I recently submitted. However, I think linker configuration is
> superior in my port. Mine has emulparms/elf_i386_qnx.sh inheriting
> from elf_i386.sh and elf_qnx.sh, eliminating duplicate definitions and
> setting things up so that definitions common to all QNX ports can live
> in one place.
Yes, that sounds better. It is the emulparms equivalent of what I did
(with help from various and sundry) in the bfd backend.
>
> Since then, I've split it into elf_qnx60.sh and elf_qnx61.sh, as the
> ELF interpreter is different in 6.0 and 6.1. I think it's marginally
> better to set the interpreter in the linker, since that allows the
> same gcc config to target both versions of the OS. At least this is
> true with my gcc port.
I will have to educate myself here. Can't comment yet...
>
> The config triple is i[3456]86-*-nto-qnx* in bfd, and i[3456]86-*-nto*
> in gas and ld. These should probably be consistant. I'd recommend the
> latter, especially if/when we have to distinguish between versions as
> the master config.guess will return a pattern like i386-pc-nto-qnx6.10.
Yup again. That looks better. Consistancy is always good. I'll make that
change here.
Thanks, J.T.
Regards,
GP
>
> --jtc
>
> --
> J.T. Conklin
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-04-19 10:43 ` J.T. Conklin
2002-04-19 17:01 ` Graeme Peterson
@ 2002-04-19 17:48 ` Graeme Peterson
2002-04-19 17:50 ` Graeme Peterson
1 sibling, 1 reply; 18+ messages in thread
From: Graeme Peterson @ 2002-04-19 17:48 UTC (permalink / raw)
To: jtc; +Cc: binutils
>
> "Graeme Peterson" <gp@qnx.com> writes:
> > Here is a patch for i386-pc-nto-qnx for inclusion in
> > GNU binutils. Thanks to all for your help.
>
> > Thanks.
> > Looking forward to any feedback.
>
> You'll need ChangeLog entries for all these changes.
Are these ok? not sure who needs them...
Thanks.
GP
bfd/ChangeLog
===================================================================
2002-04-18 Graeme Peterson <gp@qnx.com>
* Makefile.am: Add elf32-i386qnx.lo and elf32-i386qnx.c.
* Makefile.in: Same.
* config.bfd: Add i[3456]86-*-nto*) support
* configure: Add bfd_elf32_i386qnx_vec support.
* configure.in: Same.
* elf-bfd.h (struct elf_backend_data): Add new backend function
elf_backend_set_nonloadable_filepos.
* elf.c (assign_file_positions_for_segments): Add call to
elf_backend_set_nonloadable_filepos.
* elf.c (copy_private_bfd_data): Add new macro IS_CONTAINED_BY_FILEPOS.
* elf.c (_bfd_elf_copy_private_section_data): Test for
elf_backend_set_nonloadable_filepos function, and if defined don't check
against SEC_ALLOC, and setup the segments anyways.
* elf32-i386.c: Add #ifndef ELF32_I386_C_INCLUDED before including
elf32-target.h to facilitate including elf32-i386.c in other backend files.
* elf32-i386qnx.c: New QNX elf backend file.
* elfxx-target.h: Add elf_backend_set_nonloadable_filepos.
* targets.c: Add bfd_target bfd_elf32_i386qnx_vec.
gas/ChangeLog
===================================================================
2002-04-18 Graeme Peterson <gp@qnx.com>
* configure: Add i386-*-nto*.
* configure.in: Same.
ld/ChangeLog
===================================================================
2002-04-18 Graeme Peterson <gp@qnx.com>
* Makefile.in: Add ei386nto.c.
* configure.tgt: Add i[3456]86-*-nto*).
* i386nto.sh: New file.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-04-19 17:48 ` Graeme Peterson
@ 2002-04-19 17:50 ` Graeme Peterson
0 siblings, 0 replies; 18+ messages in thread
From: Graeme Peterson @ 2002-04-19 17:50 UTC (permalink / raw)
To: Graeme Peterson; +Cc: jtc, binutils
>
> >
> > "Graeme Peterson" <gp@qnx.com> writes:
> > > Here is a patch for i386-pc-nto-qnx for inclusion in
> > > GNU binutils. Thanks to all for your help.
> >
> > > Thanks.
> > > Looking forward to any feedback.
> >
> > You'll need ChangeLog entries for all these changes.
>
> Are these ok? not sure who needs them...
Just to clarify, I meant "not sure who needs to know about them..."
:-)
Regards,
GP
>
> Thanks.
> GP
>
>
> bfd/ChangeLog
> ===================================================================
> 2002-04-18 Graeme Peterson <gp@qnx.com>
>
> * Makefile.am: Add elf32-i386qnx.lo and elf32-i386qnx.c.
> * Makefile.in: Same.
> * config.bfd: Add i[3456]86-*-nto*) support
> * configure: Add bfd_elf32_i386qnx_vec support.
> * configure.in: Same.
> * elf-bfd.h (struct elf_backend_data): Add new backend function
> elf_backend_set_nonloadable_filepos.
> * elf.c (assign_file_positions_for_segments): Add call to
> elf_backend_set_nonloadable_filepos.
> * elf.c (copy_private_bfd_data): Add new macro IS_CONTAINED_BY_FILEPOS.
> * elf.c (_bfd_elf_copy_private_section_data): Test for
> elf_backend_set_nonloadable_filepos function, and if defined don't check
> against SEC_ALLOC, and setup the segments anyways.
> * elf32-i386.c: Add #ifndef ELF32_I386_C_INCLUDED before including
> elf32-target.h to facilitate including elf32-i386.c in other backend files.
> * elf32-i386qnx.c: New QNX elf backend file.
> * elfxx-target.h: Add elf_backend_set_nonloadable_filepos.
> * targets.c: Add bfd_target bfd_elf32_i386qnx_vec.
>
> gas/ChangeLog
> ===================================================================
> 2002-04-18 Graeme Peterson <gp@qnx.com>
>
> * configure: Add i386-*-nto*.
> * configure.in: Same.
>
> ld/ChangeLog
> ===================================================================
> 2002-04-18 Graeme Peterson <gp@qnx.com>
>
> * Makefile.in: Add ei386nto.c.
> * configure.tgt: Add i[3456]86-*-nto*).
> * i386nto.sh: New file.
>
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <no.id>]
* Re: i386-pc-nto-qnx patch
[not found] <no.id>
@ 2002-04-25 8:59 ` Graeme Peterson
2002-04-25 9:09 ` H . J . Lu
2002-04-25 23:40 ` J.T. Conklin
2002-05-09 8:20 ` Graeme Peterson
2002-05-10 9:57 ` Graeme Peterson
2 siblings, 2 replies; 18+ messages in thread
From: Graeme Peterson @ 2002-04-25 8:59 UTC (permalink / raw)
To: Graeme Peterson; +Cc: jtc, binutils
About the ELF interpreter. We have a different loader version in
6.1+ than in pre 6.1. We handle this in gcc (specs) and in our
front end 'qcc' (conf files).
This is how we have done it and will probably continue to do it.
It is how we ship our tools chain, and if we need to update the
loader again, then the specs and conf files for that OS version
will reflect it.
It seems to me that it is six of one, half a dozen of the other as to
whether this gets done in gcc or binutils. My preference is gcc,
because we need to have a QNX specific specs file anyway, this is
how we already do it, and this limits the number of QNX specific
changes that need to be rolled in and maintained in binutils.
Who makes this decision? There are two conflicting patch submissions,
both of which work, but not together.
Regards and thanks,
GP
> >
> > "Graeme Peterson" <gp@qnx.com> writes:
> > > Here is a patch for i386-pc-nto-qnx for inclusion in
> > > GNU binutils. Thanks to all for your help.
> >
> > > Thanks.
> > > Looking forward to any feedback.
> >
> > You'll need ChangeLog entries for all these changes.
>
> Mmm. Wondered about that. I'll look for info on format, etc...
>
> >
> > Aside from the BFD changes, these changes are similar to the binutils
> > port I recently submitted. However, I think linker configuration is
> > superior in my port. Mine has emulparms/elf_i386_qnx.sh inheriting
> > from elf_i386.sh and elf_qnx.sh, eliminating duplicate definitions and
> > setting things up so that definitions common to all QNX ports can live
> > in one place.
>
> Yes, that sounds better. It is the emulparms equivalent of what I did
> (with help from various and sundry) in the bfd backend.
>
> >
> > Since then, I've split it into elf_qnx60.sh and elf_qnx61.sh, as the
> > ELF interpreter is different in 6.0 and 6.1. I think it's marginally
> > better to set the interpreter in the linker, since that allows the
> > same gcc config to target both versions of the OS. At least this is
> > true with my gcc port.
>
> I will have to educate myself here. Can't comment yet...
>
> >
> > The config triple is i[3456]86-*-nto-qnx* in bfd, and i[3456]86-*-nto*
> > in gas and ld. These should probably be consistant. I'd recommend the
> > latter, especially if/when we have to distinguish between versions as
> > the master config.guess will return a pattern like i386-pc-nto-qnx6.10.
>
> Yup again. That looks better. Consistancy is always good. I'll make that
> change here.
>
> Thanks, J.T.
>
> Regards,
> GP
>
> >
> > --jtc
> >
> > --
> > J.T. Conklin
> >
>
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-04-25 8:59 ` Graeme Peterson
@ 2002-04-25 9:09 ` H . J . Lu
2002-04-25 10:04 ` gp
2002-04-25 23:40 ` J.T. Conklin
1 sibling, 1 reply; 18+ messages in thread
From: H . J . Lu @ 2002-04-25 9:09 UTC (permalink / raw)
To: Graeme Peterson; +Cc: jtc, binutils
On Thu, Apr 25, 2002 at 11:58:59AM -0400, Graeme Peterson wrote:
> About the ELF interpreter. We have a different loader version in
> 6.1+ than in pre 6.1. We handle this in gcc (specs) and in our
> front end 'qcc' (conf files).
>
> This is how we have done it and will probably continue to do it.
> It is how we ship our tools chain, and if we need to update the
> loader again, then the specs and conf files for that OS version
> will reflect it.
>
> It seems to me that it is six of one, half a dozen of the other as to
> whether this gets done in gcc or binutils. My preference is gcc,
> because we need to have a QNX specific specs file anyway, this is
> how we already do it, and this limits the number of QNX specific
> changes that need to be rolled in and maintained in binutils.
>
Linux passes "-dynamic-linker /lib/ld.xxxx" to ld from gcc. I think
it is more flexible. We strongly discourage using ld directly for
generating DSOs and executables on Linux.
H.J.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-04-25 9:09 ` H . J . Lu
@ 2002-04-25 10:04 ` gp
0 siblings, 0 replies; 18+ messages in thread
From: gp @ 2002-04-25 10:04 UTC (permalink / raw)
To: H . J . Lu, Graeme Peterson; +Cc: jtc, binutils
"H . J . Lu" <hjl@lucon.org> said:
> On Thu, Apr 25, 2002 at 11:58:59AM -0400, Graeme Peterson wrote:
> > About the ELF interpreter. We have a different loader version in
> > 6.1+ than in pre 6.1. We handle this in gcc (specs) and in our
> > front end 'qcc' (conf files).
> >
> > This is how we have done it and will probably continue to do it.
> > It is how we ship our tools chain, and if we need to update the
> > loader again, then the specs and conf files for that OS version
> > will reflect it.
> >
> > It seems to me that it is six of one, half a dozen of the other as to
> > whether this gets done in gcc or binutils. My preference is gcc,
> > because we need to have a QNX specific specs file anyway, this is
> > how we already do it, and this limits the number of QNX specific
> > changes that need to be rolled in and maintained in binutils.
> >
>
> Linux passes "-dynamic-linker /lib/ld.xxxx" to ld from gcc. I think
> it is more flexible. We strongly discourage using ld directly for
> generating DSOs and executables on Linux.
>
Yup. "--dynamic-linker /usr/lib/ldqnx.so.2" in our specs and conf files.
Thanks.
GP
>
> H.J.
>
--
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-04-25 8:59 ` Graeme Peterson
2002-04-25 9:09 ` H . J . Lu
@ 2002-04-25 23:40 ` J.T. Conklin
1 sibling, 0 replies; 18+ messages in thread
From: J.T. Conklin @ 2002-04-25 23:40 UTC (permalink / raw)
To: Graeme Peterson; +Cc: binutils
"Graeme Peterson" <gp@qnx.com> writes:
> It seems to me that it is six of one, half a dozen of the other as to
> whether this gets done in gcc or binutils. My preference is gcc,
> because we need to have a QNX specific specs file anyway, this is
> how we already do it, and this limits the number of QNX specific
> changes that need to be rolled in and maintained in binutils.
>
> Who makes this decision? There are two conflicting patch submissions,
> both of which work, but not together.
I'm not sure there is a conflict. My gcc port supports both QNX 6.0
and 6.1, which requires the linker to know the correct interpreter.
You have separate gcc configs for the different versions of the OS, so
the same binutils config can be used. Your gcc would presumably work
with mine, as the --dynamic-linker passed via the specs would override
the compiled in default, but my gcc port would fail.
Even though 6.0 and 6.1 are similar enough to have a common gcc config
now (assuming that ld will use the correct interpreter), I wouldn't be
surprised if some future release required separate configs. Given that
likelyhood, I can't think of a reason to let the aesthetics of a single
gcc config make the decision.
Additionally, it is unlikely that anyone is going to be using the
linker directly to create an executable. Anyone who does is going to
have to know all the details of which and in what order startup files
have to be specified. Requiring users to specify the interpreter is
not going to be a significant burden.
Having the config specify the interpreter appropriate to the specific
version of the OS does no harm, but it's benefit is slight now and is
questionable in the future (future OS releases may require separate
gcc configs anyway). Given this, I don't think there is a compelling
reason for me to submit this change.
There still is a conflict in the ports though, as mine still pulls out
generic QNX definitions into it's own emulparams .sh file which are
inherited by an x86 port specific .sh file; while Graeme's has it all
in one. If need be, I could submit this change again if his port goes
in first.
--jtc
--
J.T. Conklin
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
[not found] <no.id>
2002-04-25 8:59 ` Graeme Peterson
@ 2002-05-09 8:20 ` Graeme Peterson
2002-05-10 6:31 ` Alan Modra
2002-05-10 9:57 ` Graeme Peterson
2 siblings, 1 reply; 18+ messages in thread
From: Graeme Peterson @ 2002-05-09 8:20 UTC (permalink / raw)
To: Graeme Peterson; +Cc: binutils
Hey, all.
I've seen a lot of talk about merging patches, and was wondering
if anyone has had time to look at the i386-pc-nto-qnx patch I
submitted.
Thanks.
GP
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-05-09 8:20 ` Graeme Peterson
@ 2002-05-10 6:31 ` Alan Modra
2002-05-10 7:55 ` Graeme Peterson
2002-05-13 8:42 ` Graeme Peterson
0 siblings, 2 replies; 18+ messages in thread
From: Alan Modra @ 2002-05-10 6:31 UTC (permalink / raw)
To: Graeme Peterson; +Cc: binutils
On Thu, May 09, 2002 at 11:20:05AM -0400, Graeme Peterson wrote:
> I've seen a lot of talk about merging patches, and was wondering
> if anyone has had time to look at the i386-pc-nto-qnx patch I
> submitted.
I've looked at it a couple of times, thought "why is he doing that?"
and put it aside until I could analyse your code a little deeper.
So, why is IS_CONTAINED_BY_FILEPOS necessary? Just because
_bfd_elf_make_section_from_shdr isn't setting up lma correctly for
you? Seems to me the right solution is some tweakery to
_bfd_elf_make_section_from_shdr. You'll probably want this anyway
as other parts of bfd look at the section lma.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-05-10 6:31 ` Alan Modra
@ 2002-05-10 7:55 ` Graeme Peterson
2002-05-13 8:42 ` Graeme Peterson
1 sibling, 0 replies; 18+ messages in thread
From: Graeme Peterson @ 2002-05-10 7:55 UTC (permalink / raw)
To: Alan Modra; +Cc: binutils
Hi, Alan. Thanks for the reply. I will find out from the author of
that portion and get back to you ASAP.
Cheers.
GP
>
> On Thu, May 09, 2002 at 11:20:05AM -0400, Graeme Peterson wrote:
> > I've seen a lot of talk about merging patches, and was wondering
> > if anyone has had time to look at the i386-pc-nto-qnx patch I
> > submitted.
>
> I've looked at it a couple of times, thought "why is he doing that?"
> and put it aside until I could analyse your code a little deeper.
>
> So, why is IS_CONTAINED_BY_FILEPOS necessary? Just because
> _bfd_elf_make_section_from_shdr isn't setting up lma correctly for
> you? Seems to me the right solution is some tweakery to
> _bfd_elf_make_section_from_shdr. You'll probably want this anyway
> as other parts of bfd look at the section lma.
>
> --
> Alan Modra
> IBM OzLabs - Linux Technology Centre
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
2002-05-10 6:31 ` Alan Modra
2002-05-10 7:55 ` Graeme Peterson
@ 2002-05-13 8:42 ` Graeme Peterson
1 sibling, 0 replies; 18+ messages in thread
From: Graeme Peterson @ 2002-05-13 8:42 UTC (permalink / raw)
To: Alan Modra; +Cc: binutils
Hi, Alan.
I got this from the author of the IS_CONTAINED_BY_FILEPOS stuff.
Hope it helps. He will be looking at this a little more as well.
" If you look at the output of 'objdump -h procnto' you will see:
procnto: file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 ___procnto 00026bfb 080480d4 080480d4 000000d4 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .text 00002024 0806ecd0 0806ecd0 00026cd0 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 ___c 0000954a 08070cf4 08070cf4 00028cf4 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 ___kercalls 00000011 0807a23e 0807a23e 0003223e 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
4 .rodata 0000080d 0807a250 0807a250 00032250 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .rodata1 00000e44 0807aa60 0807aa60 00032a60 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
6 .data 00000f24 0807c8a4 0807c8a4 000338a4 2**2
CONTENTS, ALLOC, LOAD, DATA
7 .bss 00001404 0807d7c8 0807d7c8 000347c8 2**2
ALLOC
8 .segrel 000031f8 00000000 00000000 000347c8 2**0
CONTENTS, READONLY
9 .segrel 000000fc 00000000 00000000 000379c0 2**0
CONTENTS, READONLY
10 .note 00000038 00000000 00000000 00037abc 2**2
CONTENTS, READONLY
The LMA for the .segrel sections is 0.
Maybe the gnu stuff internally is setting this field from filepos or
calculating this but I am not sure. I think the Gnu linker should
only calculate LMA for loadable sections. "
So, it seems to me that since the PT_SEGREL is not loadable, then the
.segrel LMA is 0, so we can't use it, which is why IS_CONTAINED BY_FILEPOS
was written.
Does that sound right? I am on a learning curve here, and quite willing
to be corrected. BTW, has anyone tried the patch to see if it is ok, or
if it breaks stuff? The PT_SEGREL support in the patch works for us, and
I was curious to see if it passed other regressions.
Thanks, as always.
GP
>
> On Thu, May 09, 2002 at 11:20:05AM -0400, Graeme Peterson wrote:
> > I've seen a lot of talk about merging patches, and was wondering
> > if anyone has had time to look at the i386-pc-nto-qnx patch I
> > submitted.
>
> I've looked at it a couple of times, thought "why is he doing that?"
> and put it aside until I could analyse your code a little deeper.
>
> So, why is IS_CONTAINED_BY_FILEPOS necessary? Just because
> _bfd_elf_make_section_from_shdr isn't setting up lma correctly for
> you? Seems to me the right solution is some tweakery to
> _bfd_elf_make_section_from_shdr. You'll probably want this anyway
> as other parts of bfd look at the section lma.
>
> --
> Alan Modra
> IBM OzLabs - Linux Technology Centre
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: i386-pc-nto-qnx patch
[not found] <no.id>
2002-04-25 8:59 ` Graeme Peterson
2002-05-09 8:20 ` Graeme Peterson
@ 2002-05-10 9:57 ` Graeme Peterson
2 siblings, 0 replies; 18+ messages in thread
From: Graeme Peterson @ 2002-05-10 9:57 UTC (permalink / raw)
To: Graeme Peterson; +Cc: Alan Modra, binutils
Hi. I haven't yet heard back specifically regarding
IS_CONTAINED_BY_FILEPOS, but here is an overview I
sent Nick Clifton on why we need the changes made.
Hopefully it will help with your analysis.
I'll let you know when I get a response on the FILEPOS
stuff.
Thanks again.
Regards,
GP
The QNX linker issues a special class of relocations
called segment relocations (SEGREL). The problem is
that GNU BFD removes these sections. For example,
if you strip the QNX6 kernel (procnto) or objcopy it,
it is no longer usable, because the linker used in
building boot images (ldrel) needs segment relocations.
We need to preserve these sections and segments with
proper offset and size.
The function _bfd_elf_copy_private_section_data() calls
copy_private_bfd_data() only for ALLOCATED sections.
copy_private_bfd_data() creates internal structures
for segments composed of sections (mapping output sections
to segments) but only for ALLOCATED sections. For these
reasons I redesigned these functions. This function
worked for PT_LOAD and PT_NOTE segments, and for non
PT_LOAD segments containing at least one allocated
section. The PT_SEGREL has no such sections.
>
> Hi, Alan. Thanks for the reply. I will find out from the author of
> that portion and get back to you ASAP.
>
> Cheers.
> GP
>
> >
> > On Thu, May 09, 2002 at 11:20:05AM -0400, Graeme Peterson wrote:
> > > I've seen a lot of talk about merging patches, and was wondering
> > > if anyone has had time to look at the i386-pc-nto-qnx patch I
> > > submitted.
> >
> > I've looked at it a couple of times, thought "why is he doing that?"
> > and put it aside until I could analyse your code a little deeper.
> >
> > So, why is IS_CONTAINED_BY_FILEPOS necessary? Just because
> > _bfd_elf_make_section_from_shdr isn't setting up lma correctly for
> > you? Seems to me the right solution is some tweakery to
> > _bfd_elf_make_section_from_shdr. You'll probably want this anyway
> > as other parts of bfd look at the section lma.
> >
> > --
> > Alan Modra
> > IBM OzLabs - Linux Technology Centre
> >
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2002-05-13 15:42 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-17 13:05 i386-pc-nto-qnx patch Graeme Peterson
2002-04-17 20:18 ` Alan Modra
2002-04-18 7:38 ` Graeme Peterson
2002-04-18 9:58 ` H . J . Lu
2002-04-18 10:54 ` Graeme Peterson
2002-04-19 10:43 ` J.T. Conklin
2002-04-19 17:01 ` Graeme Peterson
2002-04-19 17:48 ` Graeme Peterson
2002-04-19 17:50 ` Graeme Peterson
[not found] <no.id>
2002-04-25 8:59 ` Graeme Peterson
2002-04-25 9:09 ` H . J . Lu
2002-04-25 10:04 ` gp
2002-04-25 23:40 ` J.T. Conklin
2002-05-09 8:20 ` Graeme Peterson
2002-05-10 6:31 ` Alan Modra
2002-05-10 7:55 ` Graeme Peterson
2002-05-13 8:42 ` Graeme Peterson
2002-05-10 9:57 ` Graeme Peterson
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).