lib.h:
void throw_with_try_catch();
void fun();
lib.cpp:
void undefined();
void throw_with_try_catch() {
try {
throw 1;
} catch(int) {}
undefined();
}
void fun() {}
lib.o: compiled with -ffunction-sections -fdata-sections
main.cpp:
#include "lib.h"
int main() {
fun();
}
clang main.cpp -o main lib.o -Wl,--gc-sections -mno-relax:
ld.lld: error: undefined symbol: undefined()
Is this the expected behavior?