summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2016-12-08 13:35:38 -0800
committerMatt Turner <mattst88@gmail.com>2016-12-08 13:42:01 -0800
commit9728a8bdc1d882acf534df6a86dbb435146a5ca8 (patch)
treee1cff4b483dd525acf10bee02242c2069051bcb1
parent48b08be237ae2708d36abb50ca381eb90ce51f67 (diff)
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.
-rw-r--r--build-id.lds12
1 files 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;