From 9728a8bdc1d882acf534df6a86dbb435146a5ca8 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 8 Dec 2016 13:35:38 -0800 Subject: Make the linker script work. Previously the build-id program (which was reading its own build-id worked) but the so-build-id program (was was reading the linked DSO's build id) did not. I speculated that the __note_gnu_build_id_start symbol was not being relocated properly since its address in the DSO was somewhat before the .text section, while the __note_gnu_build_id_end symbol was correct. I could even read the build-id which ended at the end symbol. I noticed that in the output of "ld --verbose" that there is only a ".interp" section immediately before .note.gnu.build-id, while in "ld --verbose -shared" there is nothing before .note.gnu.build-id. I think that probably points to the problem, but I am not sure exactly what it is. --- build-id.lds | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/build-id.lds b/build-id.lds index ae54f64..63a23f2 100644 --- a/build-id.lds +++ b/build-id.lds @@ -1,11 +1,9 @@ SECTIONS { - __note_gnu_build_id_start = .; -} -INSERT BEFORE .note.gnu.build-id; - -SECTIONS -{ - __note_gnu_build_id_end = .; + build-id : { + PROVIDE(__note_gnu_build_id_start = .); + *(.note.gnu.build-id); + PROVIDE(__note_gnu_build_id_end = .); + } } INSERT AFTER .note.gnu.build-id; -- cgit v1.2.3