生成位置无关的代码
This commit is contained in:
@@ -9,7 +9,7 @@ void set_r9(void *r9);
|
|||||||
|
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
||||||
static void * const g_r9;
|
static void * const volatile g_r9;
|
||||||
|
|
||||||
//ָ<><D6B8>app<70><70><EFBFBD><EFBFBD>
|
//ָ<><D6B8>app<70><70><EFBFBD><EFBFBD>
|
||||||
static app_struct *g_me;
|
static app_struct *g_me;
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define APP_INFO(name_,type_,size_,pro_) \
|
#define APP_INFO(name_,type_,size_,pro_) \
|
||||||
const app_info_struct __app_info= \
|
const app_info_struct __app_info __attribute__((used,section(".__app_info"))) = \
|
||||||
{\
|
{\
|
||||||
.name=name_,\
|
.name=name_,\
|
||||||
.exe_type=type_,\
|
.exe_type=type_,\
|
||||||
|
@@ -7,15 +7,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char g_test_str[]="hello world";
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
int my_main (void *ptr)
|
int my_main (void *ptr)
|
||||||
{
|
{
|
||||||
global_init(ptr);
|
global_init(ptr);
|
||||||
global_run_start();
|
global_run_start();
|
||||||
|
printf("%s\n", g_test_str);
|
||||||
//<2F><>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
|
//<2F><>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
|
||||||
WIN_WindowStruct *win=0;
|
WIN_WindowStruct *win=0;
|
||||||
if(win=WIN_GetWinByTitle(0,"calendar"),win==0)
|
if(win=WIN_GetWinByTitle(0,"calendar"),win==0)
|
||||||
{
|
{
|
||||||
|
@@ -85,6 +85,7 @@
|
|||||||
api_item realloc,40 @
|
api_item realloc,40 @
|
||||||
api_item strlen,500
|
api_item strlen,500
|
||||||
api_item sprintf,501
|
api_item sprintf,501
|
||||||
|
api_item puts,502
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -29,8 +29,12 @@ CFLAG=[
|
|||||||
|
|
||||||
# debug
|
# debug
|
||||||
'-g -gdwarf-2',
|
'-g -gdwarf-2',
|
||||||
'-fpic',
|
'-fpie',
|
||||||
'-e my_main -Wl,--section-start=.app_info=0x00000000 -nostartfiles -nodefaultlibs'
|
'-fno-plt',
|
||||||
|
'-e my_main -nostartfiles -nodefaultlibs',
|
||||||
|
'-Wl,--section-start=.__app_info=0x00000000',
|
||||||
|
'-Wl,--no-dynamic-linker',
|
||||||
|
'-Wl,--undefined=__app_info'
|
||||||
]
|
]
|
||||||
|
|
||||||
DEF=[
|
DEF=[
|
||||||
@@ -238,7 +242,7 @@ def build_target(src:list):
|
|||||||
dst=os.path.join(OUTPUT,TARGET)+".elf"
|
dst=os.path.join(OUTPUT,TARGET)+".elf"
|
||||||
if(check_rebuild(dst,obj_list)):
|
if(check_rebuild(dst,obj_list)):
|
||||||
rsp=f"{' '.join(obj_list)} -o {dst} {flags} \
|
rsp=f"{' '.join(obj_list)} -o {dst} {flags} \
|
||||||
-Wl,-Map={OUTPUT}/{TARGET}.map,--cref -Wl,--gc-sections \
|
-Wl,-Map={OUTPUT}/{TARGET}.map,--cref -Wl,-pie -Wl,--gc-sections \
|
||||||
-Wl,-print-memory-usage"
|
-Wl,-print-memory-usage"
|
||||||
print(f"链接 {dst}")
|
print(f"链接 {dst}")
|
||||||
with open(f"{OUTPUT}/{TARGET}.rsp",'w+') as f:
|
with open(f"{OUTPUT}/{TARGET}.rsp",'w+') as f:
|
||||||
|
Reference in New Issue
Block a user