⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dynlink.h

📁 nucleus_arm.rar
💻 H
字号:
// dynlink.h

// Declarations for handling imports and exports

// The import and export areas are arrays of this structure
typedef struct {
	char *name;
	unsigned long value;
} Dyn_Symbol;

// The beginning of the .text section contains one of these structures
typedef struct {
	Dyn_Symbol *export_st;	// Beginning of export array
	Dyn_Symbol *export_en;	// End of export array
	Dyn_Symbol *import_st;	// Beginning of import array
	Dyn_Symbol *import_en;	// End of import array
} Dyn_Header;

int dyn_test(void);

// Export a symbol
#define DYN_EXPORT(name)						\
		__asm__ (								\
			".section .export\n"				\
			".long __export_name_" #name "\n"	\
			".long _" #name "\n"				\
			".section .expnam\n"				\
			"__export_name_" #name ":\n"		\
			".asciz \"" #name "\"\n"			\
			".section .text\n"					\
		)

// Import a symbol
#define DYN_IMPORT(name)						\
		__asm__ (								\
			".section .import\n"				\
			".long __impvec_" #name "\n"		\
			".long __import_name_" #name "\n"	\
			".section .impnam\n"				\
			"__import_name_" #name ":\n"		\
			".asciz \"" #name "\"\n"			\
			".section .text\n"					\
			".global "_" #name "\n"				\
			"_" #name ":\n"						\
			"jmp *__impvec_" #name "\n"			\
		)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -