Skip to content

liblkl_hijack.so vs liblkl-hijack.so?  #42

@pscollins

Description

@pscollins

tools/lib/Makefile provides two targets with slightly different names:

ifneq (,$(filter $(OUTPUT_FORMAT),elf64-x86-64))
lib += lib/liblkl_hijack.so
hijack_objs = $(patsubst %.c,%.o,$(wildcard lib/hijack/*.c))
objs += $(hijack_objs)
endif


lib/liblkl_hijack.so: LDFLAGS += -ldl
lib/liblkl_hijack.so: $(hijack_objs) lib/liblkl.a
        $(CC) -o $@ -shared $^  $(LDFLAGS)

# order of -lxxx again really matters for LD_PRELOAD
lib/liblkl-hijack.so: $(hijack_objs) Makefile lib/liblkl.so
        $(CC) -shared -nodefaultlibs $(lib_objs) -Llib -llkl $(hijack_objs) \
        -ldl -lpthread -lrt -o $@

On my machine, I can't get liblkl_hijack.so to work:

➜  lib git:(debug) ✗ LD_LIBRARY_PATH=. LD_PRELOAD=liblkl_hijack.so ping localhost
ERROR: ld.so: object 'liblkl_hijack.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

The rules for liblkl_hijack.so don't make sense to me --- why would the hijacking code need to be linked against lkl on some architectures but not others? --- but if they're correct then the conditional should be rewritten to ifeq (elf64-x86-64,$(OUTPUT_FORMAT)) and the _ version should get a more descriptive name.

My suspicion is that this is a bad copy+paste or something like that --- is there a reason for it that I'm missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions