When I link a library such as libm in with ld, I need to drop the lib prefix. What if the file does not follow this naming convention? Is there a way to link it other than renaming the file?
You can have the linker search for a library named without the lib prefix:
gcc main.o -L/path/to/foo -l:foo.a
This is especially useful in environments where a list of libraries is specified and the -l flag is prepended later (eg some makefiles or eclipse CDT)