mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 11:39:44 +03:00
Demos: Link our normal startfiles into the dynamic lib demo
Now that gcc knows about crtbeginS and crtendS, and knows not to link crt0.o into shared objects, we can get rid of the hacks required due to --nostartfiles.
This commit is contained in:
parent
2979491512
commit
a755b80057
Notes:
sideshowbarker
2024-07-19 10:27:41 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/a755b80057e Pull-request: https://github.com/SerenityOS/serenity/pull/988
@ -3,14 +3,10 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// 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;
|
||||
|
@ -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) $<
|
||||
|
Loading…
Reference in New Issue
Block a user