当前位置: 动力学知识库 > 问答 > 编程问答 >

gcc - Wildcard doesn't work in Mingw (Windows) GNU ld script

问题描述:

I am using the tool chain provided by GCC ARM Embedded. It seems ld (4.9-2015-q3-update) cannot handle wild card (*) with Windows path correctly.

For example, the code snippet below

.foo_v0 { obj\*(.s_foo_v0) }

won't find files under directory obj, and .foo_v0 gets nothing. Here is the report from mapfile:

.s_foo_v0 0x00008664 0x1c

.s_foo_v0 0x00008664 0x1c obj\test\foo.o

0x00008664 foo_v0

.foo_v0 0x00008680 0x0

obj\test\*(.s_foo_v0)

0x00008680 PROVIDE (__load_start_foo_v0, LOADADDR (.foo_v0))

0x00008680 PROVIDE (__load_stop_foo_v0, (LOADADDR (.foo_v0) + SIZEOF (.foo_v0)))

Everything works fine on Cygwin, however, just need to use slash instead of backslash.

It's a known issue? Or is there a workaround?

网友答案:

Doubling the backslash solves the problem.

.foo_v0 { obj\\*(.s_foo_v0) } 

Here is the report from mapfile,

.foo_v0         0x00008664       0x1c
 obj\\*(.s_foo_v0)
 .s_foo_v0      0x00008664       0x1c obj\test\foo.o
                0x00008664                foo_v0
                0x00008664                PROVIDE (__load_start_foo_v0, LOADADDR (.foo_v0))
                0x00008680                PROVIDE (__load_stop_foo_v0, (LOADADDR (.foo_v0) + SIZEOF (.foo_v0)))

It seems the first backslash escapes the latter one, so that the latter one won't escape the wildcard.

分享给朋友:
您可能感兴趣的文章:
随机阅读: