Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use musl cross compiler made for riscv target to compile my program. When I use the cross compiler's objdump with -S flag, it produces the source code of the main program aligned with the corresponding assembly code. I want similar source code information for the library functions included in the code. For example, when I use "pthread_create" in the program, the objdump produces only the assembly code for the pthread_create function. It does not add the source code info. How do I enable that? Do I need to re-make the cross compiler? What flags do I need?

What I have tried:

I re-build the cross compiler with --enable-debug flag (source: GitHub - richfelker/musl-cross-make: Simple makefile-based build for musl cross compiler[^] )

Following are the compile commands I tried:

Shell
musl-riscv-linux-gcc -static -g pthread_code.c -o pthread_musl_debuginfo

Shell
musl-riscv-linux-objdump -x --source --full-contents -D -S pthread_musl_debuginfo > pthread_musl_debuginfo_objdump
Posted

1 solution

You'd probably have to talk to the creators of the compiler and / or the library file. Unless the source is explicitly included in the library (which would be unusual) it can't be done as you want (it's not normal to generate C code from a DLL and it wouldn't be particularly readable anyway as it's almost certainly optimised when compiled).

Bear in mind that the original source code is probably somebody's IP and that they generally don't release that to anyone who just wants it!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900