Enable -fPIC in Nanos6 loader

This commit is contained in:
Rodrigo Arias 2023-03-13 16:08:38 +01:00
parent 898534ee52
commit 9fae434553
2 changed files with 59 additions and 0 deletions

View File

@ -35,6 +35,8 @@ stdenv.mkDerivation rec {
sha256 = "YGj/cubqXaNt4lR2CnSU+nXvi+SdB56EXLhfN/ufjHs=";
};
patches = [ ./fpic.patch ];
prePatch = ''
patchShebangs scripts/generate_config.sh
'';

57
bsc/nanos6/fpic.patch Normal file
View File

@ -0,0 +1,57 @@
diff --git a/Makefile.am b/Makefile.am
index 5718226456dcf0e422200d1289a14816f51bd39d..c4d49a80f3899b6439184837555c03337b832018 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -115,7 +115,7 @@ lib_LTLIBRARIES = \
libnanos6-optimized-discrete-verbose.la \
libnanos6-optimized-regions-verbose.la
-noinst_LIBRARIES = libnanos6-main-wrapper.a libnanos6-library-mode.a
+noinst_LTLIBRARIES = libnanos6-main-wrapper.la libnanos6-library-mode.la
lib_OBJECTS = nanos6-main-wrapper.o nanos6-library-mode.o
@@ -139,7 +139,7 @@ if ANDROID
main_interception += loader/intercept-main-android.c
endif
-libnanos6_main_wrapper_a_SOURCES = \
+libnanos6_main_wrapper_la_SOURCES = \
$(main_interception) \
loader/api-versions.c \
loader/api-versions.h \
@@ -150,25 +150,27 @@ libnanos6_main_wrapper_a_SOURCES = \
loader/main-wrapper.c \
loader/main-wrapper.h
-libnanos6_main_wrapper_a_CPPFLAGS = $(CUDA_CFLAGS) $(MPI_CXXFLAGS) $(MCMODEL_FLAGS)
+libnanos6_main_wrapper_la_CPPFLAGS = $(CUDA_CFLAGS) $(MPI_CXXFLAGS) $(MCMODEL_FLAGS)
+libnanos6_main_wrapper_la_LDFLAGS = -static
-nanos6-main-wrapper.o: libnanos6-main-wrapper.a
- $(AM_V_LD)$(LD) -r --whole-archive libnanos6-main-wrapper.a -o nanos6-main-wrapper.o
+nanos6-main-wrapper.o: libnanos6-main-wrapper.la
+ $(AM_V_LD)$(LD) -r --whole-archive $(top_builddir)/.libs/libnanos6-main-wrapper.a -o nanos6-main-wrapper.o
-libnanos6_library_mode_a_SOURCES = \
+libnanos6_library_mode_la_SOURCES = \
$(library_interception) \
loader/api-versions.c \
loader/api-versions.h \
loader/device_strings.c \
loader/library-mode-init.c
-libnanos6_library_mode_a_CPPFLAGS = $(CUDA_CFLAGS) $(MPI_CXXFLAGS) $(MCMODEL_FLAGS)
+libnanos6_library_mode_la_CPPFLAGS = $(CUDA_CFLAGS) $(MPI_CXXFLAGS) $(MCMODEL_FLAGS)
+libnanos6_library_mode_la_LDFLAGS = -static
-nanos6-library-mode.o: libnanos6-library-mode.a
- $(AM_V_LD)$(LD) -r --whole-archive libnanos6-library-mode.a -o nanos6-library-mode.o
+nanos6-library-mode.o: libnanos6-library-mode.la
+ $(AM_V_LD)$(LD) -r --whole-archive $(top_builddir)/.libs/libnanos6-library-mode.a -o nanos6-library-mode.o
#