Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"less restrictive attribute than its target" warnings #135

Open
rountree opened this issue Jan 21, 2023 · 0 comments
Open

"less restrictive attribute than its target" warnings #135

rountree opened this issue Jan 21, 2023 · 0 comments
Assignees

Comments

@rountree
Copy link
Collaborator

gcc 9 introduced warnings to catch attribute mismatches. These generated warnings in the linux kernel source until the kernel was updated around v5.0.

bug report
patch

In short: don't use gcc 9 when compiling against versions of linux less than 5.0. If you do, you'll get warnings like this:

In file included from /g/g24/rountree/v/tioga/repos/msr-safe/msr_entry.c:35:
/g/g24/rountree/v/tioga/repos/msr-safe/msr_entry.c: At top level:
./include/linux/module.h:129:6: warning: ‘init_module’ specifies less restrictive attribute than its target ‘msr_init’: ‘cold’ [-Wmissing-attributes]                                                                                                                        
  129 |  int init_module(void) __attribute__((alias(#initfn)));
      |      ^~~~~~~~~~~
/g/g24/rountree/v/tioga/repos/msr-safe/msr_entry.c:364:1: note: in expansion of macro ‘module_init’
  364 | module_init(msr_init);
      | ^~~~~~~~~~~
/g/g24/rountree/v/tioga/repos/msr-safe/msr_entry.c:267:19: note: ‘init_module’ target declared here
  267 | static int __init msr_init(void)
      |                   ^~~~~~~~
In file included from /g/g24/rountree/v/tioga/repos/msr-safe/msr_entry.c:35:
./include/linux/module.h:135:7: warning: ‘cleanup_module’ specifies less restrictive attribute than its target ‘msr_exit’: ‘cold’ [-Wmissing-attributes]                                                                                                                     
  135 |  void cleanup_module(void) __attribute__((alias(#exitfn)));
      |       ^~~~~~~~~~~~~~
/g/g24/rountree/v/tioga/repos/msr-safe/msr_entry.c:388:1: note: in expansion of macro ‘module_exit’
  388 | module_exit(msr_exit)
      | ^~~~~~~~~~~
/g/g24/rountree/v/tioga/repos/msr-safe/msr_entry.c:366:20: note: ‘cleanup_module’ target declared here
  366 | static void __exit msr_exit(void)
      |                    ^~~~~~~~
@rountree rountree self-assigned this Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant