[14/21] Treat absolute imports as XTY_ER/XMC_XO

Richard Sandiford richards@transitive.com
Tue Mar 10 14:38:00 GMT 2009


The native XCOFF linker treats absolute imports as XTY_ER/XMC_XO,
so we ought to do the same.

Note that nm currently mistakes absolute symbols for common symbols.
I'm not intending to fix that.  (Can we say "C" is for constant? ;))

OK to install?

Richard


bfd/
	* xcofflink.c (bfd_xcoff_import_symbol): Treat imported absolute
	symbols as XMC_XO.

ld/testsuite/
	* ld-powerpc/aix-abs-branch-1.nd,
	ld-powerpc/aix-abs-reloc-1.nd: New tests.
	* ld-powerpc/aix52.exp: Run them.

Index: bfd/xcofflink.c
===================================================================
--- bfd/xcofflink.c	2009-03-10 13:48:18.000000000 +0000
+++ bfd/xcofflink.c	2009-03-10 13:48:48.000000000 +0000
@@ -2723,6 +2723,7 @@ bfd_xcoff_import_symbol (bfd *output_bfd
       h->root.type = bfd_link_hash_defined;
       h->root.u.def.section = bfd_abs_section_ptr;
       h->root.u.def.value = val;
+      h->smclas = XMC_XO;
     }
 
   if (!xcoff_set_import_path (info, h, imppath, impfile, impmember))
Index: ld/testsuite/ld-powerpc/aix-abs-branch-1.nd
===================================================================
--- /dev/null	2009-02-06 09:11:03.343159000 +0000
+++ ld/testsuite/ld-powerpc/aix-abs-branch-1.nd	2009-03-10 13:48:48.000000000 +0000
@@ -0,0 +1,3 @@
+0*01450000 C bar
+0*10000000 t foo
+0*10000000 T foo
Index: ld/testsuite/ld-powerpc/aix-abs-reloc-1.nd
===================================================================
--- /dev/null	2009-02-06 09:11:03.343159000 +0000
+++ ld/testsuite/ld-powerpc/aix-abs-reloc-1.nd	2009-03-10 13:48:48.000000000 +0000
@@ -0,0 +1,3 @@
+0*deadbeef C bar
+0*10000000 d foo
+0*10000000 D foo
Index: ld/testsuite/ld-powerpc/aix52.exp
===================================================================
--- ld/testsuite/ld-powerpc/aix52.exp	2009-03-10 13:48:18.000000000 +0000
+++ ld/testsuite/ld-powerpc/aix52.exp	2009-03-10 13:48:48.000000000 +0000
@@ -72,13 +72,13 @@ set aix52tests {
     {"Absolute branch test 1"
      "-shared -bI:aix-abs-branch-1.im -bE:aix-abs-branch-1.ex"
      "" {aix-abs-branch-1.s}
-     {{objdump {-dR} aix-abs-branch-1.dd}}
+     {{objdump {-dR} aix-abs-branch-1.dd} {nm {} aix-abs-branch-1.nd}}
      "aix-abs-branch-1.so"}
 
     {"Relocations against absolute symbols 1"
      "-shared -bI:aix-abs-reloc-1.im -bE:aix-abs-reloc-1.ex"
      {} {aix-abs-reloc-1.s}
-     {{objdump -sRj.data aix-abs-reloc-1.od}}
+     {{objdump -sRj.data aix-abs-reloc-1.od} {nm {} aix-abs-reloc-1.nd}}
      "aix-abs-reloc-1.so"}
 
     {"Core sections test 1" "-shared -bE:aix-core-sec-1.ex"



More information about the Binutils mailing list