Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Makerules
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ $(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \
$(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
$(LDFLAGS.so) $(LDFLAGS-lib.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
$(objdir)/../entry-patch.o
-L$(subst :, -L,$(rpath-link)) -L$(common-objpfx).. -Wl,-rpath-link=$(rpath-link):$(common-objpfx).. \
-Wl,-rpath=/data
endef

ifeq (yes,$(use-default-link))
Expand Down Expand Up @@ -593,7 +593,9 @@ endif

define build-shlib
$(build-shlib-helper) -o $@ $(shlib-lds-flags) \
$(csu-objpfx)abi-note.o $(build-shlib-objlist)
$(csu-objpfx)abi-note.o $(build-shlib-objlist) \
$(common-objpfx)../entry-patch.o $(common-objpfx)../undefined_sys_hack.o \
-luklsyms
endef

define build-module-helper
Expand Down
5 changes: 4 additions & 1 deletion csu/init-first.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ __libc_init_first (int argc, char **argv, char **envp)
/* For DSOs we do not need __libc_init_first but instead _init. */
}

extern void *entry_SYSCALL_64;

void
attribute_hidden
_init (int argc, char **argv, char **envp)
_init (int argc, char **argv, char **envp, void* dl_entry_SYSCALL_64)
{
entry_SYSCALL_64 = dl_entry_SYSCALL_64;
#endif

__libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up;
Expand Down
3 changes: 2 additions & 1 deletion elf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,8 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
$(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
$(filter-out $(map-file),$^) $(load-map-file) \
-Wl,-soname=$(rtld-installed-name) \
-Wl,-defsym=_begin=0
-Wl,-defsym=_begin=0 \
$(common-objpfx)../entry-patch.o
$(call after-link,$@.new)
$(READELF) -s $@.new \
| $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
Expand Down
2 changes: 1 addition & 1 deletion elf/dl-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

/* Type of the initializer. */
typedef void (*init_t) (int, char **, char **);

typedef void (*ukl_init_t) (int, char **, char **, void *);

static void
call_init (struct link_map *l, int argc, char **argv, char **env)
Expand Down
5 changes: 4 additions & 1 deletion sysdeps/generic/ldsodefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ typedef struct link_map *lookup_t;
# define DL_SYMBOL_ADDRESS(map, ref) \
(void *) SYMBOL_ADDRESS (map, ref, false)
# define DL_LOOKUP_ADDRESS(addr) ((ElfW(Addr)) (addr))

// XXX since ukl only supports x86_64, i'm not sure this should actually go here
extern void* entry_SYSCALL_64;
# define DL_CALL_DT_INIT(map, start, argc, argv, env) \
((init_t) (start)) (argc, argv, env)
((ukl_init_t) (start)) (argc, argv, env, entry_SYSCALL_64)
# define DL_CALL_DT_FINI(map, start) ((fini_t) (start)) ()
#endif

Expand Down
4 changes: 2 additions & 2 deletions sysdeps/hppa/dl-lookupcfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ void attribute_hidden _dl_unmap (struct link_map *map);
{ \
ElfW(Addr) addr; \
DL_DT_FUNCTION_ADDRESS(map, start, , addr) \
init_t init = (init_t) addr; \
init (argc, argv, env); \
ukl_init_t init = (ukl_init_t) addr; \
init (argc, argv, env, entry_SYSCALL_64); \
}

#define DL_CALL_DT_FINI(map, start) \
Expand Down
10 changes: 10 additions & 0 deletions sysdeps/unix/sysv/linux/ukl/libdef.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import sys

while True:
line = sys.stdin.readline()
if not len(line):
break
line = line.strip().split()
for fname in line:
if not any(["libc_hidden_def" in line for line in open(fname)]):
print(fname)
4 changes: 3 additions & 1 deletion sysdeps/unix/sysv/linux/x86_64/sysdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@
x32. */
#define ARGIFY(X) ((__typeof__ ((X) - (X))) (X))

#ifdef UKL_BP
// getting rtld to use the plt is more trouble than it's worth,
// so just have it always use UKL base model
#if defined(UKL_BP) && !IS_IN(rtld)

extern int get_bypass_syscall(void);

Expand Down