Skip to content

Commit

Permalink
Workaround bug in autoconf 2.69
Browse files Browse the repository at this point in the history
Autoconf 2.69 does not expand the $(target_cpu) variable when creating
directories, hence we have to do things manually.  Also it doesn't
seems to like the @var@ variable replacements.

Signed-off-by: Giuliano Belinassi <gbelinassi@suse.de>
  • Loading branch information
giulianobelinassi committed Jul 24, 2024
1 parent e9bd055 commit b9a5fc7
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 16 deletions.
20 changes: 12 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,21 @@ AC_SUBST([PAGE_SIZE], [$($GETCONF PAGE_SIZE)]))
_NOPS_LEN=0
_PRE_NOPS_LEN=0

AS_CASE([$host_cpu],
_LD_LINUX=""
AS_CASE([$target_cpu],
[x86_64],
[
_NOPS_LEN=16
_PRE_NOPS_LEN=14
_LD_LINUX="ld-linux-x86-64.so.2"
_PROC="x86_64"
],
[powerpc64le],
[
_NOPS_LEN=19
_PRE_NOPS_LEN=18
_LD_LINUX="ld64.so.2"
_PROC="powerpc64le"
]
)

Expand All @@ -247,15 +252,14 @@ AC_DEFINE_UNQUOTED([ULP_NOPS_LEN], [$ULP_NOPS_LEN],
AC_DEFINE_UNQUOTED([PRE_NOPS_LEN], [$PRE_NOPS_LEN],
[Padding nops before the entry point of functions])

_LD_LINUX=""
AC_CHECK_FILE("/usr/lib64/ld-linux-x86-64.so.2",
AC_SUBST([_LD_LINUX], "ld-linux-x86-64.so.2"))
AC_CHECK_FILE("/usr/lib64/ld64.so.2",
AC_SUBST([_LD_LINUX], "ld64.so.2"))
AC_DEFINE_UNQUOTED([LD_LINUX], ["$_LD_LINUX"],
[Path to the ld-linux loader] )

AC_DEFINE_UNQUOTED([LD_LINUX], ["$_LD_LINUX"], [Path to the ld-linux loader] )
# Workaround a bug in autoconf 2.69
AM_CONDITIONAL([CPU_X86_64], [test "$_PROC" == "x86_64"])
AM_CONDITIONAL([CPU_PPC64LE], [test "$_PROC" == "powerpc64le"])

# Check if -fpatchable-function-entry=$ULP_NOPS_LEN,$PRE_NOPS_LEN works
# Check if -fpatchable-function-entry=$ULP_NOPS_LEN,$RE_NOPS_LEN works
# correctly.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[extern void g(void);
Expand Down
28 changes: 23 additions & 5 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,35 @@ libpulp_la_SOURCES = \
interpose.c \
msg_queue.c \
insn_queue.c \
error.c \
arch/$(target_cpu)/ulp_interface.S \
arch/$(target_cpu)/patch.c
libpulp_la_DEPENDENCIES= libpulp.versions
error.c

libpulp_la_LDFLAGS = \
-ldl \
-l:@_LD_LINUX@ \
-Wl,--version-script=$(srcdir)/libpulp.versions \
-Wl,--hash-style=sysv \ # Ubuntu seems to default to gnu, so be clear we ...
$(AM_LDFLAGS) # ... want old style hash sections, else DT_HASH is empty.

# Workaround a bug in Autoconf 2.69
if CPU_X86_64
libpulp_la_SOURCES += \
arch/x86_64/ulp_interface.S \
arch/x86_64/patch.c

libpulp_la_LDFLAGS += \
-l:ld-linux-x86-64.so.2
endif

if CPU_PPC64LE
libpulp_la_SOURCES += \
arch/powerpc64le/ulp_interface.S \
arch/powerpc64le/patch.c

libpulp_la_LDFLAGS += \
-l:ld64.so.2
endif

libpulp_la_DEPENDENCIES= libpulp.versions

libpulp_la_LIBADD = $(top_builddir)/common/libcommon.la

AM_CFLAGS += -I$(top_srcdir)/include -I$(top_srcdir)/include/arch/$(target_cpu)
Expand Down
12 changes: 11 additions & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,19 @@ manyprocesses_LDADD = libmanyprocesses.la
manyprocesses_DEPENDENCIES = $(POST_PROCESS) $(METADATA)

dlsym_SOURCES = dlsym.c
dlsym_LDADD = -lpthread -ldl -lrt -l:@_LD_LINUX@
dlsym_LDADD = -lpthread -ldl -lrt
dlsym_DEPENDENCIES = $(POST_PROCESS) $(METADATA)

# Workaround a bug in Autoconf 2.69
if CPU_X86_64
dlsym_LDADD += \
-l:ld-linux-x86-64.so.2
endif
if CPU_PPC64LE
dlsym_LDADD += \
-l:ld64.so.2
endif

stress_SOURCES = stress.c
stress_LDADD = libstress.la
stress_DEPENDENCIES = $(POST_PROCESS) $(METADATA)
Expand Down
14 changes: 12 additions & 2 deletions tools/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,18 @@ ulp_SOURCES = \
pcqueue.c \
extract.c \
set_patchable.c \
insn_queue.c \
arch/$(target_cpu)/post-arch.c
insn_queue.c

# Workaround a bug in Autoconf 2.69
if CPU_X86_64
ulp_SOURCES += \
arch/x86_64/post-arch.c
endif

if CPU_PPC64LE
ulp_SOURCES += \
arch/powerpc64le/post-arch.c
endif

ulp_LDADD = $(top_builddir)/common/libcommon.la -lelf -ljson-c -lpthread -ldl $(LIBUNWIND_LIBS)

Expand Down

0 comments on commit b9a5fc7

Please sign in to comment.