how to compile libs?

I’m curious about how Clang (as well as other compilers) handles internal and external libraries.

Basically, I assume that by applying a multi-compilation method, the compiler reads source code files, treats undeclared parts in the file as ‘unresolved symbols’, and based on this rationale, fetches the necessary libraries as whole files. These files are then added to the source code files, parsed, and compiled, to be later combined by the linker. Of course, in C++, the presence of headers can simplify this process.

I’ve been trying to verify this understanding by reading documentation, but I haven’t found any information on this topic.

I want to understand the structure and process of Clang and enhance my understanding of the LLVM frontend. Do you have any recommended resources?

For instance, if I were to create a JavaScript to IR frontend, I’m pondering how the processing of internal JavaScript libraries, external libraries, or libraries supported in other languages would be handled.

This is done by linker

the compiler reads source code files, treats undeclared parts in the file as ‘unresolved symbols’

Correct, the compiler repeats the same process for all the source files. The linker then builds up a table of all the known symbols and undefined symbols, then do the search in all its inputs