Skip to content

Commit 8681a8d

Browse files
committed
gcc - use group for ld to resolve symbols from libraries
This fixes problem we have seen with rtos_idle_loop. The symbols was not resolved as order played a role in this case. Remove circular dependencies member, as it should not be required anymore.
1 parent c5b4c54 commit 8681a8d

File tree

1 file changed

+1
-9
lines changed
  • workspace_tools/toolchains

1 file changed

+1
-9
lines changed

workspace_tools/toolchains/gcc.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class GCC(mbedToolchain):
2727
LIBRARY_EXT = '.a'
2828

2929
STD_LIB_NAME = "lib%s.a"
30-
CIRCULAR_DEPENDENCIES = True
3130
DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
3231

3332
def __init__(self, target, options=None, notify=None, macros=None, silent=False, tool_path="", extra_verbose=False):
@@ -171,15 +170,8 @@ def link(self, output, objects, libraries, lib_dirs, mem_map):
171170
libs.append("-l%s" % name[3:])
172171
libs.extend(["-l%s" % l for l in self.sys_libs])
173172

174-
# NOTE: There is a circular dependency between the mbed library and the clib
175-
# We could define a set of week symbols to satisfy the clib dependencies in "sys.o",
176-
# but if an application uses only clib symbols and not mbed symbols, then the final
177-
# image is not correctly retargeted
178-
if self.CIRCULAR_DEPENDENCIES:
179-
libs.extend(libs)
180-
181173
self.default_cmd(self.hook.get_cmdline_linker(self.ld + ["-T%s" % mem_map, "-o", output] +
182-
objects + ["-L%s" % L for L in lib_dirs] + libs))
174+
objects + ["-L%s" % L for L in lib_dirs] + ["-Wl,--start-group"] + libs + ["-Wl,--end-group"]))
183175

184176
@hook_tool
185177
def binary(self, resources, elf, bin):

0 commit comments

Comments
 (0)