summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2015-07-15 14:53:49 +0000
committerDamien Doligez <damien.doligez-inria.fr>2015-07-15 14:53:49 +0000
commite23fa906bdf675c77c62958c45fb03def41298e8 (patch)
tree4315fb3353bdf928f11c8dce8108f41902805069 /tools
parent871de903670914c181d108aedd81081569a99334 (diff)
downloadocaml-e23fa906bdf675c77c62958c45fb03def41298e8.tar.gz
PR#6747: ocamlobjinfo: missing symbol caml_plugin_header due to underscore
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16212 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.shared8
-rw-r--r--tools/objinfo_helper.c6
2 files changed, 11 insertions, 3 deletions
diff --git a/tools/Makefile.shared b/tools/Makefile.shared
index 7a3e69fd71..9a76b75e7b 100644
--- a/tools/Makefile.shared
+++ b/tools/Makefile.shared
@@ -273,9 +273,15 @@ beforedepend:: opnames.ml
# Display info on compiled files
+ifeq "$(SYSTEM)" "macosx"
+DEF_SYMBOL_PREFIX = '-Dsymbol_prefix="_"'
+else
+DEF_SYMBOL_PREFIX = '-Dsymbol_prefix=""'
+endif
+
objinfo_helper$(EXE): objinfo_helper.c ../config/s.h
$(BYTECC) -o objinfo_helper$(EXE) $(BYTECCCOMPOPTS) \
- objinfo_helper.c $(LIBBFD_LINK)
+ $(DEF_SYMBOL_PREFIX) $(LIBBFD_INCLUDE) objinfo_helper.c $(LIBBFD_LINK)
OBJINFO=../compilerlibs/ocamlcommon.cma \
../compilerlibs/ocamlbytecomp.cma \
diff --git a/tools/objinfo_helper.c b/tools/objinfo_helper.c
index 74cfc2ebd6..ef7b7af7df 100644
--- a/tools/objinfo_helper.c
+++ b/tools/objinfo_helper.c
@@ -24,6 +24,8 @@
#include <bfd.h>
#undef PACKAGE
+#define plugin_header_sym (symbol_prefix "caml_plugin_header")
+
int main(int argc, char ** argv)
{
bfd *fd;
@@ -74,14 +76,14 @@ int main(int argc, char ** argv)
sym_count = bfd_canonicalize_dynamic_symtab (fd, symbol_table);
for (i = 0; i < sym_count; i++) {
- if (strcmp(symbol_table[i]->name, "caml_plugin_header") == 0) {
+ if (strcmp(symbol_table[i]->name, plugin_header_sym) == 0) {
printf("%ld\n", (long) (offset + symbol_table[i]->value));
bfd_close(fd);
return 0;
}
}
- fprintf(stderr, "Error: missing symbol caml_plugin_header\n");
+ fprintf(stderr, "Error: missing symbol %s\n", plugin_header_sym);
bfd_close(fd);
return 2;
}