aeubanks wrote:

this seems to break `-fPIE` builds of clang on Linux with the following:

```
ld.lld: error: undefined symbol: alloca
>>> referenced by cc1_main.cpp
>>>               
>>> tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o:(ensureStackAddressSpace())
```

the call to `alloca` 
[here](https://github.com/llvm/llvm-project/blob/2fcfc9754a16805b81e541dc8222a8b5cf17a121/clang/tools/driver/cc1_main.cpp#L130)
 should be a call to `__builtin_alloca`

```
$ cat /usr/include/alloca.h
...
/* Remove any previous definition.  */
#undef  alloca

/* Allocate a block that will be freed when the calling function exits.  */
extern void *alloca (size_t __size) __THROW;

#ifdef  __GNUC__
# define alloca(size)   __builtin_alloca (size)
#endif /* GCC.  */
...
```

But the newly included `clang/Basic/Builtins.h` has [`#undef 
alloca`](https://github.com/llvm/llvm-project/blob/2fcfc9754a16805b81e541dc8222a8b5cf17a121/clang/include/clang/Basic/Builtins.h#L25)
 which messes with that.

I think we can probably just remove the code in `cc1_main.cpp` since it's a 
workaround for < Linux 4.1, which has been EOL since 2018.

https://github.com/llvm/llvm-project/pull/71709
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to