This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: ld/2218: Weak undefined symbol doesn't work properly with PIE


On Tue, Feb 21, 2006 at 11:24:24AM +1030, Alan Modra wrote:
> On Sun, Feb 19, 2006 at 07:31:58PM -0800, H. J. Lu wrote:
> > On Tue, Feb 21, 2006 at 10:35:47AM +1030, Alan Modra wrote:
> > > On Sun, Feb 19, 2006 at 06:10:01PM -0800, H. J. Lu wrote:
> > > > Do you have a patch for ia64?
> > > 
> > > Nope.  I was leaving that to you.
> > 
> > I don't understand why we should do the same thing over and over in
> > so many backends. A target hook should reduce the code duplication if
> > a few targets want to do it differently.
> 
> Show me the code.  I will not approve a target hook that does worse than
> a backend implementation.  ie. that makes symbols dynamic unnecessarily.
> 

I am checking this patch to test weak undefined data. I will
fix ia64 backend.


H.J.
----
2006-02-20  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/2218
	* ld-pie/pie.exp: Add the weak undefined data test.

	* ld-pie/weakundef-data.c: New file.

--- ld/testsuite/ld-pie/pie.exp.data	2006-01-27 06:32:04.000000000 -0800
+++ ld/testsuite/ld-pie/pie.exp	2006-02-20 11:58:19.000000000 -0800
@@ -26,6 +26,7 @@ if { ![istarget *-*-linux*] } {
 
 set array_tests {
     {"weak undefined" "-pie" "" {weakundef.c} "weakundef" "weakundef.out" "-fPIC"}
+    {"weak undefined data" "-pie" "" {weakundef-data.c} "weakundef-data" "weakundef.out" "-fPIC"}
 }
 
 run_ld_link_exec_tests [] $array_tests
--- ld/testsuite/ld-pie/weakundef-data.c.data	2006-02-20 11:56:43.000000000 -0800
+++ ld/testsuite/ld-pie/weakundef-data.c	2006-02-20 11:57:11.000000000 -0800
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#pragma weak undef_data
+
+extern int undef_data (void);
+int (*ptr_to_data)(void) = undef_data;
+
+int
+main (void)
+{
+  if (ptr_to_data == NULL)
+    printf ("PASSED\n");
+
+  return 0;
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]