Skip to content

[llvm][lit] Omit vendor in triples for "native" feature #136325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 15 additions & 2 deletions llvm/utils/lit/lit/llvm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ def user_is_root():
return False


def remove_triple_vendor(triple):
components = triple.split("-")

# Remove vendor component (e.g. unknown, pc) if present.
if len(components) == 4:
del components[1]

return "-".join(components)


class LLVMConfig(object):
def __init__(self, lit_config, config):
self.lit_config = lit_config
Expand Down Expand Up @@ -108,14 +118,17 @@ def __init__(self, lit_config, config):
elif platform.system() == "OS/390":
features.add("system-zos")

# Native compilation: host arch == default triple arch
# Native compilation: host arch == default triple arch (sans vendor)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Without vendor assuming the vendor is not significant to ABI.

Maybe you could say:
Native compilation: host arch == default triple arch (for ABI purposes)

# Both of these values should probably be in every site config (e.g. as
# part of the standard header. But currently they aren't)
host_triple = getattr(config, "host_triple", None)
target_triple = getattr(config, "target_triple", None)
features.add("host=%s" % host_triple)
features.add("target=%s" % target_triple)
if host_triple and host_triple == target_triple:

if host_triple and remove_triple_vendor(host_triple) == remove_triple_vendor(
target_triple
):
features.add("native")

# Sanitizers.
Expand Down
Loading