[all-commits] [llvm/llvm-project] d5eb0a: [JITLink][i386] Avoid 'i386' name clashing with bu...

Dimitry Andric via All-commits all-commits at lists.llvm.org
Wed Apr 23 14:20:57 PDT 2025


  Branch: refs/heads/users/DimitryAndric/fix-jitlink-i386-1
  Home:   https://github.com/llvm/llvm-project
  Commit: d5eb0a9484013197bd04ca40ead93fd5532a0c45
      https://github.com/llvm/llvm-project/commit/d5eb0a9484013197bd04ca40ead93fd5532a0c45
  Author: Dimitry Andric <dimitry at andric.com>
  Date:   2025-04-23 (Wed, 23 Apr 2025)

  Changed paths:
    M llvm/include/llvm/ExecutionEngine/JITLink/i386.h
    M llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
    M llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
    M llvm/lib/ExecutionEngine/JITLink/i386.cpp
    M llvm/unittests/ExecutionEngine/JITLink/StubsTests.cpp

  Log Message:
  -----------
  [JITLink][i386] Avoid 'i386' name clashing with built-in macro

When compiling llvm on an actual i386 platform, both clang and gcc
define a built-in macro `i386` to the value 1. This clashes with the
`llvm::jitlink::i386` namespace:

```
In file included from llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp:18:
llvm/include/llvm/ExecutionEngine/JITLink/i386.h:19:24: error: expected '{'
   19 | namespace llvm::jitlink::i386 {
      |                        ^
llvm/include/llvm/ExecutionEngine/JITLink/i386.h:19:26: error: expected unqualified-id
   19 | namespace llvm::jitlink::i386 {
      |                          ^
```

The macro name 'i386' is obviously a historical bad choice, but since it
existed long before llvm, llvm should either rename its namespace, or
actively undefine the macro in `i386.h` (similar to e.g.
https://github.com/google/swiftshader/blob/master/third_party/llvm-16.0/Android.bp#L1510).

This particular pull request implements the rename, but is meant to
gauge opinions on how to solve this issue.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list