1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

Prefix external symbols in llvm-c-test.

This makes it less likely to clash with other stuff that might be linked
in by change, e.g. ncurses exposes an external function called simply
"echo", so linking ncurses statically into the binary explodes in funny
ways.

llvm-svn: 259882
This commit is contained in:
Benjamin Kramer 2016-02-05 13:31:14 +00:00
parent c3580d7a36
commit 9180c5c3f6
10 changed files with 46 additions and 46 deletions

View File

@ -139,9 +139,9 @@ static void handle_line(char **tokens, int ntokens) {
LLVMDisposeModule(M);
}
int calc(void) {
int llvm_calc(void) {
tokenize_stdin(handle_line);
llvm_tokenize_stdin(handle_line);
return 0;
}

View File

@ -83,12 +83,12 @@ static void handle_line(char **tokens, int ntokens) {
do_disassemble(triple, features, disbuf, disbuflen);
}
int disassemble(void) {
int llvm_disassemble(void) {
LLVMInitializeAllTargetInfos();
LLVMInitializeAllTargetMCs();
LLVMInitializeAllDisassemblers();
tokenize_stdin(handle_line);
llvm_tokenize_stdin(handle_line);
return 0;
}

View File

@ -520,10 +520,10 @@ static void clone_functions(LLVMModuleRef Src, LLVMModuleRef Dst) {
}
}
int echo(void) {
int llvm_echo(void) {
LLVMEnablePrettyStackTrace();
LLVMModuleRef Src = load_module(false, true);
LLVMModuleRef Src = llvm_load_module(false, true);
LLVMContextRef Ctx = LLVMContextCreate();
LLVMModuleRef Dst = LLVMModuleCreateWithNameInContext("<stdin>", Ctx);

View File

@ -18,7 +18,7 @@
#define MAX_TOKENS 512
#define MAX_LINE_LEN 1024
void tokenize_stdin(void (*cb)(char **tokens, int ntokens)) {
void llvm_tokenize_stdin(void (*cb)(char **tokens, int ntokens)) {
char line[MAX_LINE_LEN];
char *tokbuf[MAX_TOKENS];

View File

@ -21,33 +21,33 @@ extern "C" {
#endif
// helpers.c
void tokenize_stdin(void (*cb)(char **tokens, int ntokens));
void llvm_tokenize_stdin(void (*cb)(char **tokens, int ntokens));
// module.c
LLVMModuleRef load_module(bool Lazy, bool New);
int module_dump(bool Lazy, bool New);
int module_list_functions(void);
int module_list_globals(void);
LLVMModuleRef llvm_load_module(bool Lazy, bool New);
int llvm_module_dump(bool Lazy, bool New);
int llvm_module_list_functions(void);
int llvm_module_list_globals(void);
// calc.c
int calc(void);
int llvm_calc(void);
// disassemble.c
int disassemble(void);
int llvm_disassemble(void);
// metadata.c
int add_named_metadata_operand(void);
int set_metadata(void);
int llvm_add_named_metadata_operand(void);
int llvm_set_metadata(void);
// object.c
int object_list_sections(void);
int object_list_symbols(void);
int llvm_object_list_sections(void);
int llvm_object_list_symbols(void);
// targets.c
int targets_list(void);
int llvm_targets_list(void);
// echo.c
int echo(void);
int llvm_echo(void);
#ifdef __cplusplus
}

View File

@ -60,33 +60,33 @@ int main(int argc, char **argv) {
LLVMInitializeCore(pr);
if (argc == 2 && !strcmp(argv[1], "--lazy-new-module-dump")) {
return module_dump(true, true);
return llvm_module_dump(true, true);
} else if (argc == 2 && !strcmp(argv[1], "--new-module-dump")) {
return module_dump(false, true);
return llvm_module_dump(false, true);
} else if (argc == 2 && !strcmp(argv[1], "--lazy-module-dump")) {
return module_dump(true, false);
return llvm_module_dump(true, false);
} else if (argc == 2 && !strcmp(argv[1], "--module-dump")) {
return module_dump(false, false);
return llvm_module_dump(false, false);
} else if (argc == 2 && !strcmp(argv[1], "--module-list-functions")) {
return module_list_functions();
return llvm_module_list_functions();
} else if (argc == 2 && !strcmp(argv[1], "--module-list-globals")) {
return module_list_globals();
return llvm_module_list_globals();
} else if (argc == 2 && !strcmp(argv[1], "--targets-list")) {
return targets_list();
return llvm_targets_list();
} else if (argc == 2 && !strcmp(argv[1], "--object-list-sections")) {
return object_list_sections();
return llvm_object_list_sections();
} else if (argc == 2 && !strcmp(argv[1], "--object-list-symbols")) {
return object_list_symbols();
return llvm_object_list_symbols();
} else if (argc == 2 && !strcmp(argv[1], "--disassemble")) {
return disassemble();
return llvm_disassemble();
} else if (argc == 2 && !strcmp(argv[1], "--calc")) {
return calc();
return llvm_calc();
} else if (argc == 2 && !strcmp(argv[1], "--add-named-metadata-operand")) {
return add_named_metadata_operand();
return llvm_add_named_metadata_operand();
} else if (argc == 2 && !strcmp(argv[1], "--set-metadata")) {
return set_metadata();
return llvm_set_metadata();
} else if (argc == 2 && !strcmp(argv[1], "--echo")) {
return echo();
return llvm_echo();
} else {
print_usage();
}

View File

@ -14,7 +14,7 @@
#include "llvm-c-test.h"
int add_named_metadata_operand(void) {
int llvm_add_named_metadata_operand(void) {
LLVMModuleRef m = LLVMModuleCreateWithName("Mod");
LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };
@ -26,7 +26,7 @@ int add_named_metadata_operand(void) {
return 0;
}
int set_metadata(void) {
int llvm_set_metadata(void) {
LLVMBuilderRef b = LLVMCreateBuilder();
LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };

View File

@ -25,7 +25,7 @@ static void diagnosticHandler(LLVMDiagnosticInfoRef DI, void *C) {
exit(1);
}
LLVMModuleRef load_module(bool Lazy, bool New) {
LLVMModuleRef llvm_load_module(bool Lazy, bool New) {
LLVMMemoryBufferRef MB;
LLVMModuleRef M;
char *msg = NULL;
@ -62,8 +62,8 @@ LLVMModuleRef load_module(bool Lazy, bool New) {
return M;
}
int module_dump(bool Lazy, bool New) {
LLVMModuleRef M = load_module(Lazy, New);
int llvm_module_dump(bool Lazy, bool New) {
LLVMModuleRef M = llvm_load_module(Lazy, New);
char *irstr = LLVMPrintModuleToString(M);
puts(irstr);
@ -74,8 +74,8 @@ int module_dump(bool Lazy, bool New) {
return 0;
}
int module_list_functions(void) {
LLVMModuleRef M = load_module(false, false);
int llvm_module_list_functions(void) {
LLVMModuleRef M = llvm_load_module(false, false);
LLVMValueRef f;
f = LLVMGetFirstFunction(M);
@ -115,8 +115,8 @@ int module_list_functions(void) {
return 0;
}
int module_list_globals(void) {
LLVMModuleRef M = load_module(false, false);
int llvm_module_list_globals(void) {
LLVMModuleRef M = llvm_load_module(false, false);
LLVMValueRef g;
g = LLVMGetFirstGlobal(M);

View File

@ -17,7 +17,7 @@
#include <stdio.h>
#include <stdlib.h>
int object_list_sections(void) {
int llvm_object_list_sections(void) {
LLVMMemoryBufferRef MB;
LLVMObjectFileRef O;
LLVMSectionIteratorRef sect;
@ -49,7 +49,7 @@ int object_list_sections(void) {
return 0;
}
int object_list_symbols(void) {
int llvm_object_list_symbols(void) {
LLVMMemoryBufferRef MB;
LLVMObjectFileRef O;
LLVMSectionIteratorRef sect;

View File

@ -14,7 +14,7 @@
#include "llvm-c/TargetMachine.h"
#include <stdio.h>
int targets_list(void) {
int llvm_targets_list(void) {
LLVMTargetRef t;
LLVMInitializeAllTargetInfos();
LLVMInitializeAllTargets();