diff --git a/Demos/DynamicLink/LinkLib/DynamicLib.cpp b/Demos/DynamicLink/LinkLib/DynamicLib.cpp index 106eeb73a4..481cda0f58 100644 --- a/Demos/DynamicLink/LinkLib/DynamicLib.cpp +++ b/Demos/DynamicLink/LinkLib/DynamicLib.cpp @@ -3,14 +3,10 @@ #include #include -// FIXME: See Makefile. We need -ffreestanding and -nostartfiles to -// Get GCC to stop linking crt0.o w/our .so. -// So, we need __dso_handle. ... Yikes -extern void* __dso_handle __attribute__((__section__(".sdata"))); -extern void* __dso_handle __attribute__((__visibility__("hidden"))); -void* __dso_handle = (void*)1234; // FIXME: Is the dynamic linker supposed to set this value? // FIXME: Things defined in crt0 >:( +// We need to figure out a better way to get these symbols defined and available +// Even if we're linking a shared object. __thread int errno; char* __static_environ[] = { nullptr }; // We don't get the environment without some libc workarounds.. char** environ = __static_environ; diff --git a/Demos/DynamicLink/LinkLib/Makefile b/Demos/DynamicLink/LinkLib/Makefile index daac238c4e..80abed2882 100644 --- a/Demos/DynamicLink/LinkLib/Makefile +++ b/Demos/DynamicLink/LinkLib/Makefile @@ -11,8 +11,5 @@ all: $(DYNLIBRARY) DynamicLib.o: DynamicLib.cpp $(CXX) -DDEBUG -fPIC -isystem../../../ -o $@ -c $< -# FIXME: Why do I need -nostartfiles and -nofreestanding? -# GCC isn't smart enough to not link crt0 against this dynamic lib -# which is clearly wrong. Isn't it? We don't want _start... $(DYNLIBRARY): DynamicLib.o - $(CXX) -shared -nostartfiles -ffreestanding -o $(DYNLIBRARY) $< + $(CXX) -shared -o $(DYNLIBRARY) $<