Skip to content

Commit e7fbff9

Browse files
authored
Merge pull request #20 from dcdillon/bugfix/plugin-and-stripper-2
Stripper and plugin now dig down to the actual linker
2 parents 8a7f225 + a2bdf82 commit e7fbff9

File tree

2 files changed

+45
-9
lines changed

2 files changed

+45
-9
lines changed

R/plugin.R

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@
1212
if (shlib_ld != "") {
1313
shlib_ld_good <- tryCatch({
1414
shlib_ld_results <- system(paste0(shlib_ld, " --version"), intern=TRUE)
15-
shlib_ld_good <- any(grepl(linker_pattern, shlib_ld_results))
15+
16+
if (any(grepl(linker_pattern, shlib_ld_results))) {
17+
shlib_ld_prog <- system(paste0(shlib_ld, " --print-prog-name=ld"), intern=TRUE)
18+
shlib_ld_results <- system(paste0(shlib_ld_prog, " --version"), intern=TRUE)
19+
20+
shlib_ld_good <- (grepl("^GNU (ld|gold)", shlib_ld_results[1]))
21+
} else {
22+
shlib_ld_good <- FALSE
23+
}
24+
1625
shlib_ld_good
1726
}, warning = function(w) {
1827
return(FALSE)
@@ -25,8 +34,17 @@
2534

2635
if (shlib_cxxld != "") {
2736
shlib_cxxld_good <- tryCatch({
28-
shlib_cxxld_results <- system(paste0(shlib_ld, " --version"), intern=TRUE)
29-
shlib_cxxld_good <- any(grepl(linker_pattern, shlib_ld_results))
37+
shlib_cxxld_results <- system(paste0(shlib_cxxld, " --version"), intern=TRUE)
38+
39+
if (any(grepl(linker_pattern, shlib_cxxld_results))) {
40+
shlib_cxxld_prog <- system(paste0(shlib_cxxld, " --print-prog-name=ld"), intern=TRUE)
41+
shlib_cxxld_results <- system(paste0(shlib_cxxld_prog, " --version"), intern=TRUE)
42+
43+
shlib_cxxld_good <- (grepl("^GNU (ld|gold)", shlib_cxxld_results[1]))
44+
} else {
45+
shlib_cxxld_good <- FALSE
46+
}
47+
3048
shlib_cxxld_good
3149
}, warning = function(w) {
3250
return(FALSE)

inst/tools/stripper

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,40 @@ SHLIB_CXXLD_RESULTS=0
2727

2828
if [ "$SHLIB_LD" != "" ]; then
2929
OUTPUT=`$SHLIB_LD --version`
30+
LD_PROG=""
3031

3132
case "$OUTPUT" in
32-
*gcc*) SHLIB_LD_RESULTS=1 ;;
33-
*g++*) SHLIB_LD_RESULTS=1 ;;
34-
*clang*) SHLIB_LD_RESULTS=1 ;;
33+
*gcc*) LD_PROG=`$SHLIB_LD --print-prog-name=ld` ;;
34+
*g++*) LD_PROG=`$SHLIB_LD --print-prog-name=ld` ;;
35+
*clang*) LD_PROG=`$SHLIB_LD --print-prog-name=ld` ;;
3536
esac
37+
38+
if [ "$LD_PROG" != "" ]; then
39+
OUTPUT=`$LD_PROG --version`
40+
case "$OUTPUT" in
41+
GNU?ld*) SHLIB_LD_RESULTS=1 ;;
42+
GNU?gold*) SHLIB_LD_RESULTS=1 ;;
43+
esac
44+
fi
3645
fi
3746

3847
if [ "$SHLIB_CXXLD" != "" ]; then
3948
OUTPUT=`$SHLIB_CXXLD --version`
49+
LD_PROG=""
4050

4151
case "$OUTPUT" in
42-
*gcc*) SHLIB_CXXLD_RESULTS=1 ;;
43-
*g++*) SHLIB_CXXLD_RESULTS=1 ;;
44-
*clang*) SHLIB_CXXLD_RESULTS=1 ;;
52+
*gcc*) LD_PROG=`$SHLIB_CXXLD --print-prog-name=ld` ;;
53+
*g++*) LD_PROG=`$SHLIB_CXXLD --print-prog-name=ld` ;;
54+
*clang*) LD_PROG=`$SHLIB_CXXLD --print-prog-name=ld` ;;
4555
esac
56+
57+
if [ "$LD_PROG" != "" ]; then
58+
OUTPUT=`$LD_PROG --version`
59+
case "$OUTPUT" in
60+
GNU?ld*) SHLIB_CXXLD_RESULTS=1 ;;
61+
GNU?gold*) SHLIB_CXXLD_RESULTS=1 ;;
62+
esac
63+
fi
4664
fi
4765

4866
# Clean up any temporary files we created previously

0 commit comments

Comments
 (0)