Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/trusted/service_runtime/linux/ld_bfd.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,18 @@ def main(args):
else:
cxx_bin = os.getenv('CXX', 'g++')

if 0:
args = [FindLDBFD(cxx_bin)] + args
libgcc = FindLibgcc(cxx_bin)
if libgcc is not None:
args.append(libgcc)
elif re.search('[^a-zA-Z]g[+][+]$', cxx_bin):
# Match g++, <target>-g++, but not clang++.
if re.search('[^a-zA-Z]g[+][+]$', cxx_bin):
ld = cxx_bin[:-3] + "ld.bfd"
args = [ld] + args
else:
# We just have to hope the system binutils knows about the target platform
args = ["ld.bfd"] + args

libgcc = FindLibgcc(cxx_bin)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't adding libgcc be inside the g++ detection block?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I remember now that the "g++" string depends on what architecture was used, not what compiler...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can have a libgcc on the system you compile with clang for, what matters there is to find libgcc when it's present (and then, less likely to be used).

if libgcc is not None:
args.append(libgcc)

return subprocess.call(args)

if __name__ == "__main__":
Expand Down