public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [patch] more PE fixes
@ 2000-06-24 13:06 Nick Clifton
  2000-06-24 18:33 ` DJ Delorie
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Clifton @ 2000-06-24 13:06 UTC (permalink / raw)
  To: dj; +Cc: binutils

Hi DJ,

: 2000-06-23  DJ Delorie  <dj@cygnus.com>
: 
: 	* config/tc-i386.c (md_estimate_size_before_relax): Revert
: 	more changes from Sept 1999
: 	(md_apply_fix3): ditto

Approved.  (for now... :-)

Cheers
	Nick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] more PE fixes
  2000-06-24 13:06 [patch] more PE fixes Nick Clifton
@ 2000-06-24 18:33 ` DJ Delorie
  0 siblings, 0 replies; 8+ messages in thread
From: DJ Delorie @ 2000-06-24 18:33 UTC (permalink / raw)
  To: nickc; +Cc: binutils

> : 2000-06-23  DJ Delorie  <dj@cygnus.com>
> : 
> : 	* config/tc-i386.c (md_estimate_size_before_relax): Revert
> : 	more changes from Sept 1999
> : 	(md_apply_fix3): ditto
> 
> Approved.  (for now... :-)

Applied!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] more PE fixes
  2000-06-23 11:20         ` DJ Delorie
@ 2000-06-23 11:23           ` H . J . Lu
  0 siblings, 0 replies; 8+ messages in thread
From: H . J . Lu @ 2000-06-23 11:23 UTC (permalink / raw)
  To: DJ Delorie; +Cc: binutils

On Fri, Jun 23, 2000 at 02:20:30PM -0400, DJ Delorie wrote:
> 
> > Reverting the patch may mean my PE assembler may not generate working
> > relocatable object files which can be linked under ELF. It may not
> > really matter too much since I only use it for my PE/ELF testcase.
> > I am glad my work is done :-).
> 
> Could you try it and see?  Meanwhile, I'll try your patch with cygwin.

I will once it is checked in. FYI, my patch doesn't affect the native
PE linker. I don't know if/how it can be used for the native linker.


H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] more PE fixes
  2000-06-23 10:51       ` H . J . Lu
@ 2000-06-23 11:20         ` DJ Delorie
  2000-06-23 11:23           ` H . J . Lu
  0 siblings, 1 reply; 8+ messages in thread
From: DJ Delorie @ 2000-06-23 11:20 UTC (permalink / raw)
  To: hjl; +Cc: binutils

> Reverting the patch may mean my PE assembler may not generate working
> relocatable object files which can be linked under ELF. It may not
> really matter too much since I only use it for my PE/ELF testcase.
> I am glad my work is done :-).

Could you try it and see?  Meanwhile, I'll try your patch with cygwin.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] more PE fixes
  2000-06-23 10:39     ` DJ Delorie
@ 2000-06-23 10:51       ` H . J . Lu
  2000-06-23 11:20         ` DJ Delorie
  0 siblings, 1 reply; 8+ messages in thread
From: H . J . Lu @ 2000-06-23 10:51 UTC (permalink / raw)
  To: DJ Delorie; +Cc: binutils

On Fri, Jun 23, 2000 at 01:39:33PM -0400, DJ Delorie wrote:
> 
> > I believe the PE assembler is ok. The problem may be the PE linker.
> 
> I don't know which is at fault.  I suspect that Donn will revert my
> patch when he finishes his PE work, but until then I'd rather just
> make it the way it used to be, as I know the linker can handle that
> case.

Reverting the patch may mean my PE assembler may not generate working
relocatable object files which can be linked under ELF. It may not
really matter too much since I only use it for my PE/ELF testcase.
I am glad my work is done :-).

H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] more PE fixes
  2000-06-23 10:17   ` H . J . Lu
@ 2000-06-23 10:39     ` DJ Delorie
  2000-06-23 10:51       ` H . J . Lu
  0 siblings, 1 reply; 8+ messages in thread
From: DJ Delorie @ 2000-06-23 10:39 UTC (permalink / raw)
  To: hjl; +Cc: binutils

> I believe the PE assembler is ok. The problem may be the PE linker.

I don't know which is at fault.  I suspect that Donn will revert my
patch when he finishes his PE work, but until then I'd rather just
make it the way it used to be, as I know the linker can handle that
case.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] more PE fixes
  2000-06-23  9:25 ` DJ Delorie
@ 2000-06-23 10:17   ` H . J . Lu
  2000-06-23 10:39     ` DJ Delorie
  0 siblings, 1 reply; 8+ messages in thread
From: H . J . Lu @ 2000-06-23 10:17 UTC (permalink / raw)
  To: DJ Delorie; +Cc: binutils

On Fri, Jun 23, 2000 at 12:25:20PM -0400, DJ Delorie wrote:
> 
> With this patch, I can build cygwin stuff.  I expect Donn to put this
> back when he gets the rest of the Interix patches ready, but for now
> I've reverted some of his patches to get PE working again.  OK to
> apply?
> 
> 2000-06-23  DJ Delorie  <dj@cygnus.com>
> 
> 	* config/tc-i386.c (md_estimate_size_before_relax): Revert
> 	more changes from Sept 1999
> 	(md_apply_fix3): ditto
> 
> Index: tc-i386.c
> ===================================================================
> RCS file: /cvs/src/src/gas/config/tc-i386.c,v
> retrieving revision 1.56
> diff -p -3 -r1.56 tc-i386.c
> *** tc-i386.c	2000/06/22 10:49:13	1.56
> --- tc-i386.c	2000/06/23 16:05:08
> *************** int
> *** 1023,1029 ****
>   tc_i386_fix_adjustable (fixP)
>        fixS * fixP;
>   {
> ! #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) || defined (TE_PE)
>     /* Prevent all adjustments to global symbols, or else dynamic
>        linking will not work correctly.  */
>     if (S_IS_EXTERNAL (fixP->fx_addsy)
> --- 1023,1029 ----
>   tc_i386_fix_adjustable (fixP)
>        fixS * fixP;
>   {
> ! #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
>     /* Prevent all adjustments to global symbols, or else dynamic
>        linking will not work correctly.  */
>     if (S_IS_EXTERNAL (fixP->fx_addsy)
> *************** md_estimate_size_before_relax (fragP, se
> *** 3776,3782 ****
>        an externally visible symbol, because it may be overridden by a
>        shared library.  */
>     if (S_GET_SEGMENT (fragP->fr_symbol) != segment
> ! #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) || defined (TE_PE)
>         || S_IS_EXTERNAL (fragP->fr_symbol)
>         || S_IS_WEAK (fragP->fr_symbol)
>   #endif
> --- 3776,3782 ----
>        an externally visible symbol, because it may be overridden by a
>        shared library.  */
>     if (S_GET_SEGMENT (fragP->fr_symbol) != segment
> ! #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
>         || S_IS_EXTERNAL (fragP->fr_symbol)
>         || S_IS_WEAK (fragP->fr_symbol)
>   #endif
> *************** md_apply_fix3 (fixP, valp, seg)
> *** 4038,4071 ****
>   	 address offset for a PC relative symbol.  */
>         if (S_GET_SEGMENT (fixP->fx_addsy) != seg)
>   	value += md_pcrel_from (fixP);
> -       else if (S_IS_EXTERNAL (fixP->fx_addsy)
> - 	       || S_IS_WEAK (fixP->fx_addsy))
> - 	{
> - 	  /* We are generating an external relocation for this defined
> -              symbol.  We add the address, because
> -              bfd_install_relocation will subtract it.  VALUE already
> -              holds the symbol value, because fixup_segment added it
> -              in.  We subtract it out, and then we subtract it out
> -              again because bfd_install_relocation will add it in
> -              again.  */
> - 	  value += md_pcrel_from (fixP);
> - 	  value -= 2 * S_GET_VALUE (fixP->fx_addsy);
> - 	}
>   #endif
>       }
> - #ifdef TE_PE
> -   else if (fixP->fx_addsy != NULL
> - 	   && S_IS_DEFINED (fixP->fx_addsy)
> - 	   && (S_IS_EXTERNAL (fixP->fx_addsy)
> - 	       || S_IS_WEAK (fixP->fx_addsy)))
> -     {
> -       /* We are generating an external relocation for this defined
> -          symbol.  VALUE already holds the symbol value, and
> -          bfd_install_relocation will add it in again.  We don't want
> -          either addition.  */
> -       value -= 2 * S_GET_VALUE (fixP->fx_addsy);
> -     }
> - #endif
>   
>     /* Fix a few things - the dynamic linker expects certain values here,
>        and we must not dissappoint it. */

I believe the PE assembler is ok. The problem may be the PE linker. I
say that because the PE assembler seems to generate the same output as
the Microsoft assembler. I learned that while working on linking the PE
relocatable object files generated by the Microsoft assembler under
ia32/ELF. Please see my change:

2000-06-18  H.J. Lu  <hjl@gnu.org>

        * coff-i386.c (coff_i386_reloc): Don't return in case of 
        output_bfd == (bfd *) NULL if COFF_WITH_PE is defined.
        Compensate PE relocations when linking with non-PE object
        files to generate a non-PE executable.

You may need the similar changes in the native PE linker.


H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch] more PE fixes
       [not found] <Pine.LNX.4.21.0006240152040.26260-100000@front.linuxcare.com.au>
@ 2000-06-23  9:25 ` DJ Delorie
  2000-06-23 10:17   ` H . J . Lu
  0 siblings, 1 reply; 8+ messages in thread
From: DJ Delorie @ 2000-06-23  9:25 UTC (permalink / raw)
  To: binutils

With this patch, I can build cygwin stuff.  I expect Donn to put this
back when he gets the rest of the Interix patches ready, but for now
I've reverted some of his patches to get PE working again.  OK to
apply?

2000-06-23  DJ Delorie  <dj@cygnus.com>

	* config/tc-i386.c (md_estimate_size_before_relax): Revert
	more changes from Sept 1999
	(md_apply_fix3): ditto

Index: tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.56
diff -p -3 -r1.56 tc-i386.c
*** tc-i386.c	2000/06/22 10:49:13	1.56
--- tc-i386.c	2000/06/23 16:05:08
*************** int
*** 1023,1029 ****
  tc_i386_fix_adjustable (fixP)
       fixS * fixP;
  {
! #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) || defined (TE_PE)
    /* Prevent all adjustments to global symbols, or else dynamic
       linking will not work correctly.  */
    if (S_IS_EXTERNAL (fixP->fx_addsy)
--- 1023,1029 ----
  tc_i386_fix_adjustable (fixP)
       fixS * fixP;
  {
! #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
    /* Prevent all adjustments to global symbols, or else dynamic
       linking will not work correctly.  */
    if (S_IS_EXTERNAL (fixP->fx_addsy)
*************** md_estimate_size_before_relax (fragP, se
*** 3776,3782 ****
       an externally visible symbol, because it may be overridden by a
       shared library.  */
    if (S_GET_SEGMENT (fragP->fr_symbol) != segment
! #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) || defined (TE_PE)
        || S_IS_EXTERNAL (fragP->fr_symbol)
        || S_IS_WEAK (fragP->fr_symbol)
  #endif
--- 3776,3782 ----
       an externally visible symbol, because it may be overridden by a
       shared library.  */
    if (S_GET_SEGMENT (fragP->fr_symbol) != segment
! #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
        || S_IS_EXTERNAL (fragP->fr_symbol)
        || S_IS_WEAK (fragP->fr_symbol)
  #endif
*************** md_apply_fix3 (fixP, valp, seg)
*** 4038,4071 ****
  	 address offset for a PC relative symbol.  */
        if (S_GET_SEGMENT (fixP->fx_addsy) != seg)
  	value += md_pcrel_from (fixP);
-       else if (S_IS_EXTERNAL (fixP->fx_addsy)
- 	       || S_IS_WEAK (fixP->fx_addsy))
- 	{
- 	  /* We are generating an external relocation for this defined
-              symbol.  We add the address, because
-              bfd_install_relocation will subtract it.  VALUE already
-              holds the symbol value, because fixup_segment added it
-              in.  We subtract it out, and then we subtract it out
-              again because bfd_install_relocation will add it in
-              again.  */
- 	  value += md_pcrel_from (fixP);
- 	  value -= 2 * S_GET_VALUE (fixP->fx_addsy);
- 	}
  #endif
      }
- #ifdef TE_PE
-   else if (fixP->fx_addsy != NULL
- 	   && S_IS_DEFINED (fixP->fx_addsy)
- 	   && (S_IS_EXTERNAL (fixP->fx_addsy)
- 	       || S_IS_WEAK (fixP->fx_addsy)))
-     {
-       /* We are generating an external relocation for this defined
-          symbol.  VALUE already holds the symbol value, and
-          bfd_install_relocation will add it in again.  We don't want
-          either addition.  */
-       value -= 2 * S_GET_VALUE (fixP->fx_addsy);
-     }
- #endif
  
    /* Fix a few things - the dynamic linker expects certain values here,
       and we must not dissappoint it. */
--- 4038,4045 ----

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2000-06-24 18:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-24 13:06 [patch] more PE fixes Nick Clifton
2000-06-24 18:33 ` DJ Delorie
     [not found] <Pine.LNX.4.21.0006240152040.26260-100000@front.linuxcare.com.au>
2000-06-23  9:25 ` DJ Delorie
2000-06-23 10:17   ` H . J . Lu
2000-06-23 10:39     ` DJ Delorie
2000-06-23 10:51       ` H . J . Lu
2000-06-23 11:20         ` DJ Delorie
2000-06-23 11:23           ` H . J . Lu

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).