cem 156c41aa9b kldxref(8): Sort MDT_MODULE info first in linker.hints output
MDT_MODULE info is required to be ordered before any other MDT metadata for
a given kld because it serves as an implicit record boundary between
distinct klds for linker.hints consumers.  kldxref(8) has previously relied
on the assumption that MDT_MODULE was ordered relative to other module
metadata in kld objects by source code ordering.

However, C does not require implementations to emit file scope objects in
any particular order, and it seems that GCC 6.4.0 and/or binutils 2.32 ld
may reorder emitted objects with respect to source code ordering.

So: just take two passes over a given .ko's module metadata, scanning for
the MDT_MODULE on the first pass and the other metadata on subsequent
passes.  It's not super expensive and not exactly a performance-critical
piece of code.  This ensures MDT_MODULE is always ordered before
MDT_PNP_INFO and other MDTs, regardless of compiler/linker movement.  As a
fringe benefit, it removes the requirement that care be taken to always
order MODULE_PNP_INFO after DRIVER_MODULE in source code.

Reviewed by:	emaste, imp
Differential Revision:	https://reviews.freebsd.org/D20405
2019-05-27 17:33:20 +00:00
..
2019-03-29 20:21:28 +00:00
2017-10-31 00:07:04 +00:00
2017-10-31 00:07:04 +00:00
2018-08-11 13:23:09 +00:00
2018-12-19 21:56:54 +00:00
2019-04-02 12:50:01 +00:00
2019-03-14 14:34:36 +00:00
2018-08-19 07:12:35 +00:00
2018-11-30 19:40:16 +00:00
2019-02-05 21:37:34 +00:00
2019-02-04 21:28:25 +00:00
2018-06-06 18:52:33 +00:00
2019-02-21 01:30:37 +00:00
2018-08-12 13:29:40 +00:00
2018-05-28 09:41:44 +00:00
2017-12-28 05:34:04 +00:00
2019-05-04 02:09:30 +00:00
2018-01-02 16:50:57 +00:00
2017-10-31 00:07:04 +00:00
2018-10-22 02:34:10 +00:00
2019-02-04 21:28:25 +00:00
2018-02-23 17:20:53 +00:00
2018-05-19 20:57:22 +00:00
2019-05-22 01:22:33 +00:00
2019-02-04 21:28:25 +00:00
2019-02-04 21:28:25 +00:00
2018-09-19 07:09:55 +00:00
2018-06-17 17:31:16 +00:00
2019-02-03 08:15:26 +00:00
2018-03-19 05:49:26 +00:00
2019-03-05 02:53:41 +00:00
2019-04-22 17:52:46 +00:00
2018-12-19 22:47:37 +00:00
2019-04-23 03:52:43 +00:00
2018-02-08 14:53:34 +00:00
2017-10-31 00:07:04 +00:00
2019-05-24 05:34:21 +00:00
2019-05-24 05:34:21 +00:00
2018-07-24 20:20:17 +00:00