LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-11-2011, 05:52 AM   #1
theoutkast
LQ Newbie
 
Registered: Jul 2011
Posts: 3

Rep: Reputation: Disabled
Command to list headers included in a .ko files


Hello Everybody,

I don't know if it is right place to ask my question, so please move it if it is not.

Let me explain you the context of my issue:
In my project, I use strncmp/strncpy fonctions.
But during the compilation/link I have this error:
Quote:
static declaration of 'strncpy' follows non-static declaration
That means that string.h is already included, but not the right one.

So I would like to know if there is a command to show all headers included in a ko module.

Thanks for the help!
 
Old 07-11-2011, 06:37 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hello

I don't know much about .ko files, but the objdump/readelf commands are used for getting info about ELF files.

man objdump
man readelf
 
Old 07-11-2011, 07:46 AM   #3
theoutkast
LQ Newbie
 
Registered: Jul 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you Guttorm for the speed of your answer.

I looked around readelf/objdump but if I understand well, it does'nt seem to be what I'm looking for

I'm looking for a command which allow me to show all .h (and their location) used to build my module (.ko).

Thank you!
 
Old 07-11-2011, 07:56 AM   #4
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Are you saying that you are trying to include string.h in a kernel module?
 
Old 07-11-2011, 08:16 AM   #5
theoutkast
LQ Newbie
 
Registered: Jul 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Yes

It is a specific string.h write for kernel land.

I find command "nm -s module.ko", but it shows me where symbol is used, but not which .h it is from...

Last edited by theoutkast; 07-11-2011 at 08:19 AM.
 
Old 07-11-2011, 08:21 AM   #6
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
<deleted>

Last edited by Aquarius_Girl; 07-11-2011 at 08:22 AM.
 
Old 07-11-2011, 10:12 AM   #7
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
You could use grep to find all "#include"s in all C source files for the particular module. Following up on that, you would have to recursively visit each included header. This would take some programming, best done in AWK or Perl. One factor is that the recursion is not a static thing, as the compiler takes the -I (uppercase eye) argument that modifies its list of places to look for headers. You would have to build that capability into your tool.

--- rod.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Is it possible to use the ls command to list files in one column? BobNutfield Slackware 23 09-21-2010 02:13 AM
Command to join text files with headers chips11 Linux - Newbie 3 11-19-2008 03:43 PM
Command to list files by permissions rickh Programming 5 06-20-2007 09:08 AM
Command to run another command against a list of files psweetma Linux - General 3 11-09-2005 05:29 PM
Command to list some files? AoiSora Programming 13 10-29-2003 04:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration