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]

[PATCH] linker regression fix


The patch in http://sourceware.org/ml/binutils/2005-04/msg00325.html
causes
local absolute symbols, including .file ones, to be removed from the
linker
output. This patch tries to adjust this.

Built and tested on i686-pc-linux-gnu, x86_64-unknown-linux-gnu,
ia64-unknown-linux-gnu, and for a large number of cross targets.

Jan

bfd/
2005-10-21  Jan Beulich  <jbeulich@novell.com>

	* elflink.c (elf_link_input_bfd): Check for absolute symbols
before
	deciding to remove those not in any output section.

ld/testsuite/
2005-10-21  Jan Beulich  <jbeulich@novell.com>

	* ld-elf/empty2.[sd]: New.

---
/home/jbeulich/src/binutils/mainline/2005-10-20/bfd/elflink.c	2005-09-28
17:30:35.000000000 +0200
+++ 2005-10-20/bfd/elflink.c	2005-10-20 16:59:37.552695912 +0200
@@ -6871,8 +6871,9 @@ elf_link_input_bfd (struct elf_final_lin
 	continue;
 
       /* If the section is not in the output BFD's section list, it is
not
-	 being output.  */
-      if (bfd_section_removed_from_list (output_bfd,
isec->output_section))
+	 being output. But don't consider the *ABS* section here.  */
+      if (bfd_section_removed_from_list (output_bfd,
isec->output_section)
+	  && !bfd_is_abs_section (isec->output_section))
 	continue;
 
       /* Get the name of the symbol.  */
---
/home/jbeulich/src/binutils/mainline/2005-10-20/ld/testsuite/ld-elf/empty2.d	1970-01-01
01:00:00.000000000 +0100
+++ 2005-10-20/ld/testsuite/ld-elf/empty2.d	2005-10-21
10:22:36.000000000 +0200
@@ -0,0 +1,11 @@
+#source: empty2.s
+#ld:
+#readelf: -s
+#xfail: "d30v-*-*" "dlx-*-*" "hppa*-*-*" "i960-*-*" "or32-*-*"
"pj-*-*"
+
+#...
+[ 	]+[0-9]+:[ 	]+0+[ 	]+0[ 	]+FILE[	 ]+LOCAL[
	]+DEFAULT[ 	]+ABS empty2.s
+[ 	]+[0-9]+:[ 	]+0*12345678[ 	]+0[ 	]+NOTYPE[	
]+LOCAL[ 	]+DEFAULT[ 	]+ABS constant
+#...
+[ 	]+[0-9]+:[ 	]+[0-9a-f]+[ 	]+[0-9]+[ 	]+FUNC[	
]+GLOBAL[ 	]+DEFAULT[ 	]+[1-9] _start
+#pass
---
/home/jbeulich/src/binutils/mainline/2005-10-20/ld/testsuite/ld-elf/empty2.s	1970-01-01
01:00:00.000000000 +0100
+++ 2005-10-20/ld/testsuite/ld-elf/empty2.s	2005-10-21
10:22:43.000000000 +0200
@@ -0,0 +1,18 @@
+	.file "empty2.s"
+	.equiv constant, 0x12345678
+	.section .bss
+bar:
+	.text
+	.type start,"function"
+	.global start
+start:
+	.type _start,"function"
+	.global _start
+_start:
+	.type __start,"function"
+	.global __start
+__start:
+	.type main,"function"
+	.global main
+main:
+	.long constant

Attachment: binutils-mainline-ld-local-absolute.patch
Description: Binary data


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