wildcard doesn't work correctly in ld script

Asked by Wei-Ren Chen

It seems ld (4.9-2015-q3-update) cannot handle wildcard (*) 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\*(.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?

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
Wei-Ren Chen
Solved:
Last query:
Last reply:
Revision history for this message
Wei-Ren Chen (chenwj-cs97g) said :
#1

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.

Revision history for this message
Andreas Fritiofson (andreas-fritiofson) said :
#2

Can't you just use forward slashes? Windows doesn't care and it would make the script portable.

Revision history for this message
Wei-Ren Chen (chenwj-cs97g) said :
#3

Forward slash doesn't work. Here is the ld script,

    .foo_v0 { obj/*(.s_foo_v0) }

and 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/*(.s_foo_v0)
                0x00008680 PROVIDE (__load_start_foo_v0, LOADADDR (.foo_v0))
                0x00008680 PROVIDE (__load_stop_foo_v0, (LOADADDR (.foo_v0) + SIZEOF (.foo_v0)))