Skip to content

Commit 38b2a41

Browse files
author
hornik
committed
Include symbols from static libraries used in PKG_LIBS in symbols.rds (PR#18789).
git-svn-id: https://svn.r-project.org/R/trunk@87984 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 2cbf0b7 commit 38b2a41

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

share/make/shlib.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ shlib-clean:
2222
## FIXME: why not Rscript?
2323
symbols.rds: $(OBJECTS)
2424
@$(ECHO) "tools:::.shlib_objects_symbol_tables()" | \
25-
$(R_HOME)/bin/R --vanilla --no-echo --args $(OBJECTS)
25+
$(R_HOME)/bin/R --vanilla --no-echo --args $(OBJECTS) --pkglibs $(PKG_LIBS)
2626

2727
compilers:
2828
@$(ECHO) "CC = $(CC)"

src/library/tools/R/sotools.R

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,36 @@ function(x, ...)
10481048
.shlib_objects_symbol_tables <-
10491049
function(file = "symbols.rds")
10501050
{
1051-
objects <- commandArgs(trailingOnly = TRUE)
1051+
args <- commandArgs(trailingOnly = TRUE)
1052+
## <FIXME WINDOWS>
1053+
if(.Platform$OS.type != "windows") {
1054+
pos <- which(args == "--pkglibs")[1L]
1055+
objects <- args[seq_len(pos - 1L)]
1056+
pkglibs <- args[-seq_len(pos)]
1057+
} else {
1058+
objects <- args
1059+
pkglibs <- character()
1060+
}
1061+
## </FIXME>
1062+
## Also determine the local static libraries linked against by
1063+
## following the approach suggested in section "Compiling in
1064+
## sub-directories" of WRE.
1065+
if(length(pkglibs)) {
1066+
files <- list.files("..", recursive = TRUE, pattern = "[.]a$",
1067+
full.names = TRUE)
1068+
if(any(ind <- startsWith(files, "../src/")))
1069+
files[ind] <- substring(files[ind], 8L)
1070+
## Case A: local static libs given via their path.
1071+
libpaths <- pkglibs[file.exists(pkglibs)]
1072+
## Case B: local static libs given as '-lfoo'.
1073+
libnames <- pkglibs[startsWith(pkglibs, "-l")]
1074+
libnames <- sprintf("lib%s.a", substring(libnames, 3L))
1075+
objects <- c(objects,
1076+
files[normalizePath(files) %in%
1077+
normalizePath(libpaths)],
1078+
files[basename(files) %in% libnames])
1079+
objects <- unique(objects)
1080+
}
10521081
tables <- lapply(objects, read_symbols_from_object_file)
10531082
names(tables) <- objects
10541083
saveRDS(tables, file = file, version = 2)

0 commit comments

Comments
 (0)