public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Jim Wilson <wilson@cygnus.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] [PATCH] Fix for kernel DRM build
Date: Tue, 16 Jan 2001 00:42:26 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590693005047@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590678205902@msgid-missing>

>     ld: drivers/char/drm/drm.o: linking 64-bit files with 32-bit
>     files
>     ld: drivers/char/drm/drm.o: linking constant-gp files with
>     non-constant-gp files

I've sent a proposed patch to binutils@sources.redhat.com for comment.

I don't like HJ's proposed solution, which is to ignore the ELF header flags
if an object file is empty.  That can mask real errors, as this ar/ld -r
trick is not the only way to create empty object files.

My proposed patch fixes the linker to notice when the output file is empty,
and then we set the ELF header flags from the first member of the first
archive even though we aren't linking it in.  This fixes the kernel build
failure.  Alternatively, it might be better to check the ELF header flags
of every member of every archive to avoid ambiguity, but that seemed like
unnecessary extra work so I won't do that unless the binutils maintainers
request it.

Here is my proposed patch.


2001-01-15  Jim Wilson  <wilson@redhat.com>

	* ldlang.c (lang_check): If file_chain.head is NULL, then find first
	member of first archive, and call bfd_merge_private_bfd_data on it.

Index: ldlang.c
=================================RCS file: /cvs/cvsfiles/devo/ld/ldlang.c,v
retrieving revision 1.289
diff -p -r1.289 ldlang.c
*** ldlang.c	2000/07/10 11:46:54	1.289
--- ldlang.c	2001/01/16 00:03:58
*************** lang_check ()
*** 3477,3482 ****
--- 3477,3507 ----
  	    bfd_set_error_handler (pfn);
  	}
      }
+ 
+   /* There can be no used input files if the only inputs are archives.
+      In that case, arbitrarily pick the first element of the first archive
+      and use that one to initialize private bfd data.  This construct occurs
+      in the linux kernel, and if we don't have the bfd_merge_private_bfd_data
+      call, we can get errors in the final link.  */
+   if (file_chain.head = NULL)
+     {
+       lang_input_statement_type *f;
+ 
+       for (f = (lang_input_statement_type *) input_file_chain.head;
+ 	   f != NULL;
+ 	   f = (lang_input_statement_type *) f->next_real_file)
+ 	{
+ 	  if (f->the_bfd
+ 	      && bfd_check_format (f->the_bfd, bfd_archive))
+ 	    {
+ 	      bfd *member;
+ 
+ 	      member = bfd_openr_next_archived_file (f->the_bfd, (bfd *) NULL);
+ 	      bfd_merge_private_bfd_data (member, output_bfd);
+ 	      break;
+ 	    }
+ 	}
+     }
  }
  
  /* Look through all the global common symbols and attach them to the



  parent reply	other threads:[~2001-01-16  0:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-09 22:32 [Linux-ia64] [PATCH] Fix for kernel DRM build Uros Prestor
2001-01-09 22:46 ` David Mosberger
2001-01-10  1:35 ` H . J . Lu
2001-01-16  0:42 ` Jim Wilson [this message]
2001-01-16  1:13 ` H . J . Lu
2001-01-16  2:02 ` Jim Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-ia64-105590693005047@msgid-missing \
    --to=wilson@cygnus.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox