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: Commit: Fix note generation relocs


Hi H.J.

>>         * write.c (maybe_generate_build_notes): Bias reloc offsets by the
>>         number of notes already generated.

> A testcase?

Thanks for reminding me.  I am applying the attached patch to add a testcase.

Cheers
  Nick

gas/ChangeLog
2018-07-13  Nick Clifton  <nickc@redhat.com>

	* testsuite/gas/elf/missing-build-notes.s: New test.  Checks that
	relocs are correctly generated for missing build notes.
	* testsuite/gas/elf/missing-build-notes.d: New file.  Expected
	output from objdump.
	* testsuite/gas/elf/elf.exp: Run the new test.
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index bb10ac63bc..a7c793b0b0 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -244,6 +244,8 @@ if { [is_elf_format] } then {
     run_dump_test "bad-group"
 
     run_dump_test "syms"
+
+    run_dump_test "missing-build-notes"
     
     # hpux has a non-standard common directive.
     if { ![istarget "*-*-hpux*"] } then {
--- /dev/null	2018-07-13 08:28:39.448999904 +0100
+++ gas/testsuite/gas/elf/missing-build-notes.s	2018-07-13 12:03:50.663096879 +0100
@@ -0,0 +1,6 @@
+	.text
+	.dc.l	1
+
+	.section .text.unused,"ax"
+	.dc.l 	 2
+	
--- /dev/null	2018-07-13 08:28:39.448999904 +0100
+++ gas/testsuite/gas/elf/missing-build-notes.d	2018-07-13 15:41:40.982551210 +0100
@@ -0,0 +1,14 @@
+# as: --generate-missing-build-notes=yes
+# objdump: -r
+#skip: mips*-*-openbsd
+
+# Check that the relocations are for increasing addresses...
+
+#...
+RELOCATION RECORDS FOR \[.gnu.build.attributes\]:
+OFFSET[ 	]+TYPE[ 	]+VALUE 
+0+014 .*[ 	]+.*
+0+0(18|1c) .*[ 	]+.*
+0+0(30|38) .*[ 	]+.*
+0+0(34|40) .*[ 	]+.*
+#pass

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