<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/scripts/mod/modpost.c, branch v6.7.9</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.7.9</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.7.9'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2024-02-23T08:51:39Z</updated>
<entry>
<title>modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS</title>
<updated>2024-02-23T08:51:39Z</updated>
<author>
<name>Nathan Chancellor</name>
<email>nathan@kernel.org</email>
</author>
<published>2024-01-23T22:59:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3f9ba399b0e9ae572fcf4ec104aca85adda27a7a'/>
<id>urn:sha1:3f9ba399b0e9ae572fcf4ec104aca85adda27a7a</id>
<content type='text'>
commit 397586506c3da005b9333ce5947ad01e8018a3be upstream.

After the linked LLVM change, building ARCH=um defconfig results in a
segmentation fault in modpost. Prior to commit a23e7584ecf3 ("modpost:
unify 'sym' and 'to' in default_mismatch_handler()"), there was a
warning:

  WARNING: modpost: vmlinux.o(__ex_table+0x88): Section mismatch in reference to the .ltext:(unknown)
  WARNING: modpost: The relocation at __ex_table+0x88 references
  section ".ltext" which is not in the list of
  authorized sections.  If you're adding a new section
  and/or if this reference is valid, add ".ltext" to the
  list of authorized sections to jump to on fault.
  This can be achieved by adding ".ltext" to
  OTHER_TEXT_SECTIONS in scripts/mod/modpost.c.

The linked LLVM change moves global objects to the '.ltext' (and
'.ltext.*' with '-ffunction-sections') sections with '-mcmodel=large',
which ARCH=um uses. These sections should be handled just as '.text'
and '.text.*' are, so add them to TEXT_SECTIONS.

Cc: stable@vger.kernel.org
Closes: https://github.com/ClangBuiltLinux/linux/issues/1981
Link: https://github.com/llvm/llvm-project/commit/4bf8a688956a759b7b6b8d94f42d25c13c7af130
Signed-off-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>modpost: fix section mismatch message for RELA</title>
<updated>2023-11-16T11:14:44Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-10-31T17:46:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1c4a7587d1bbee0fd53b63af60e4244a62775f57'/>
<id>urn:sha1:1c4a7587d1bbee0fd53b63af60e4244a62775f57</id>
<content type='text'>
The section mismatch check prints a bogus symbol name on some
architectures.

[test code]

  #include &lt;linux/init.h&gt;

  int __initdata foo;
  int get_foo(void) { return foo; }

If you compile it with GCC for riscv or loongarch, modpost will show an
incorrect symbol name:

  WARNING: modpost: vmlinux: section mismatch in reference: get_foo+0x8 (section: .text) -&gt; done (section: .init.data)

To get the correct symbol address, the st_value must be added.

This issue has never been noticed since commit 93684d3b8062 ("kbuild:
include symbol names in section mismatch warnings") presumably because
st_value becomes zero on most architectures when the referenced symbol
is looked up. It is not true for riscv or loongarch, at least.

With this fix, modpost will show the correct symbol name:

  WARNING: modpost: vmlinux: section mismatch in reference: get_foo+0x8 (section: .text) -&gt; foo (section: .init.data)

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Reviewed-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
</content>
</entry>
<entry>
<title>modpost: squash ALL_{INIT,EXIT}_TEXT_SECTIONS to ALL_TEXT_SECTIONS</title>
<updated>2023-10-28T12:31:22Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-10-22T17:06:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=34fcf231dcf94d7dea29c070228c4b93849f4850'/>
<id>urn:sha1:34fcf231dcf94d7dea29c070228c4b93849f4850</id>
<content type='text'>
ALL_INIT_TEXT_SECTIONS and ALL_EXIT_TEXT_SECTIONS are only used in
the macro definition of ALL_TEXT_SECTIONS.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: merge sectioncheck table entries regarding init/exit sections</title>
<updated>2023-10-28T12:31:22Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-10-22T17:06:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b3d4f446fc0f6bf6d50abfc403eb375d9b9f6378'/>
<id>urn:sha1:b3d4f446fc0f6bf6d50abfc403eb375d9b9f6378</id>
<content type='text'>
Check symbol references from normal sections to init/exit sections in
a single entry.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: use ALL_INIT_SECTIONS for the section check from DATA_SECTIONS</title>
<updated>2023-10-28T12:31:22Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-10-22T17:06:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e578e4e3110635b20786e442baa3aeff9bb65f95'/>
<id>urn:sha1:e578e4e3110635b20786e442baa3aeff9bb65f95</id>
<content type='text'>
ALL_INIT_SECTIONS is defined as follows:

  #define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: disallow the combination of EXPORT_SYMBOL and __meminit*</title>
<updated>2023-10-28T12:31:22Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-10-22T17:06:10Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a3df1526da480c089c20868b7f4d486b9f266001'/>
<id>urn:sha1:a3df1526da480c089c20868b7f4d486b9f266001</id>
<content type='text'>
Theoretically, we could export conditionally-discarded code sections,
such as .meminit*, if all the users can become modular under a certain
condition. However, that would be difficult to control and such a tricky
case has never occurred.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: remove EXIT_SECTIONS macro</title>
<updated>2023-10-28T12:31:22Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-10-22T17:06:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=48cd8df7afd1eef22cf7b125697a6d7c3d168c5c'/>
<id>urn:sha1:48cd8df7afd1eef22cf7b125697a6d7c3d168c5c</id>
<content type='text'>
ALL_EXIT_SECTIONS and EXIT_SECTIONS are the same. Remove the latter.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: remove MEM_INIT_SECTIONS macro</title>
<updated>2023-10-28T12:31:22Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-10-22T17:06:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=473a45bb35f080e31cb4fe45e905bfe3bd407fdf'/>
<id>urn:sha1:473a45bb35f080e31cb4fe45e905bfe3bd407fdf</id>
<content type='text'>
ALL_XXXINIT_SECTIONS and MEM_INIT_SECTIONS are the same.
Remove the latter.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: remove more symbol patterns from the section check whitelist</title>
<updated>2023-10-28T12:31:22Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-10-22T17:06:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e1dc1bfe5b27842c9e43a1f2d42c34decb0660c3'/>
<id>urn:sha1:e1dc1bfe5b27842c9e43a1f2d42c34decb0660c3</id>
<content type='text'>
These symbol patterns were whitelisted to allow them to reference to
functions with the old __devinit and __devexit annotations.

We stopped doing this a long time ago, for example, commit 6f039790510f
("Drivers: scsi: remove __dev* attributes.") remove those annotations
from the scsi drivers.

Keep *_ops, *_probe, and *_console, otherwise they will really cause
section mismatch warnings.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>modpost: disallow *driver to reference .meminit* sections</title>
<updated>2023-10-28T12:31:22Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-10-22T17:06:06Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=50cccec15c48814765895891ca0d95d989b6a419'/>
<id>urn:sha1:50cccec15c48814765895891ca0d95d989b6a419</id>
<content type='text'>
Drivers must not reference .meminit* sections, which are discarded
when CONFIG_MEMORY_HOTPLUG=n.

The reason for whitelisting "*driver" in the section mismatch check
was to allow drivers to reference symbols annotated as __devinit or
__devexit that existed in the past.

Those annotations were removed by the following commits:

 - 54b956b90360 ("Remove __dev* markings from init.h")
 - 92e9e6d1f984 ("modpost.c: Stop checking __dev* section mismatches")

Remove the stale whitelist.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
</feed>
