使用before_Link自定义链接顺序并未奏效 #5181
Answered
by
star-hengxing
Jackey990709
asked this question in
Q&A
-
我希望通过使用before_Link对链接顺序进行自定义,目的是在链接的过程中先链接Exception.c.o再链接startup_S32K146.S.o,但使用之后并没有实现预期的效果,依然先链接的startup_S32K146.S.o,不知是否是我的before_Link里编写的内容有问题 |
Beta Was this translation helpful? Give feedback.
Answered by
star-hengxing
Jun 4, 2024
Replies: 3 comments 13 replies
-
这不应该 链接脚本改该干的事情么。为啥不直接用 link_scripts |
Beta Was this translation helpful? Give feedback.
12 replies
-
看了下源码,objectfiles 接口返回的是 target 里的变量(如果有缓存),这里可以像指针一样直接修改内容就生效? |
Beta Was this translation helpful? Give feedback.
1 reply
-
target("main")
set_kind("binary")
add_files("src/*.c")
before_link(function (target)
local objectfiles = target:objectfiles()
local tmp = objectfiles[1]
objectfiles[1] = objectfiles[2]
objectfiles[2] = tmp
end) 这里当成指针用应该就行了 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Jackey990709
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Jackey990709
这里当成指针用应该就行了