@@ -217,8 +217,8 @@ void symbols__fixup_duplicate(struct rb_root_cached *symbols)
217
217
}
218
218
}
219
219
220
- void symbols__fixup_end ( struct rb_root_cached * symbols ,
221
- bool is_kallsyms __maybe_unused )
220
+ /* Update zero-sized symbols using the address of the next symbol */
221
+ void symbols__fixup_end ( struct rb_root_cached * symbols , bool is_kallsyms )
222
222
{
223
223
struct rb_node * nd , * prevnd = rb_first_cached (symbols );
224
224
struct symbol * curr , * prev ;
@@ -232,8 +232,29 @@ void symbols__fixup_end(struct rb_root_cached *symbols,
232
232
prev = curr ;
233
233
curr = rb_entry (nd , struct symbol , rb_node );
234
234
235
- if (prev -> end == prev -> start || prev -> end != curr -> start )
236
- arch__symbols__fixup_end (prev , curr );
235
+ /*
236
+ * On some architecture kernel text segment start is located at
237
+ * some low memory address, while modules are located at high
238
+ * memory addresses (or vice versa). The gap between end of
239
+ * kernel text segment and beginning of first module's text
240
+ * segment is very big. Therefore do not fill this gap and do
241
+ * not assign it to the kernel dso map (kallsyms).
242
+ *
243
+ * In kallsyms, it determines module symbols using '[' character
244
+ * like in:
245
+ * ffffffffc1937000 T hdmi_driver_init [snd_hda_codec_hdmi]
246
+ */
247
+ if (prev -> end == prev -> start ) {
248
+ /* Last kernel/module symbol mapped to end of page */
249
+ if (is_kallsyms && (!strchr (prev -> name , '[' ) !=
250
+ !strchr (curr -> name , '[' )))
251
+ prev -> end = roundup (prev -> end + 4096 , 4096 );
252
+ else
253
+ prev -> end = curr -> start ;
254
+
255
+ pr_debug4 ("%s sym:%s end:%#" PRIx64 "\n" ,
256
+ __func__ , prev -> name , prev -> end );
257
+ }
237
258
}
238
259
239
260
/* Last entry */
0 commit comments