Issue |
80649
|
Summary |
[AArch64] Enhanced Large Code Model and Default PIE ON: Bug Fix and PIC Compatibility
|
Labels |
new issue
|
Assignees |
|
Reporter |
wc00862805aj
|
In the commit (https://github.com/llvm/llvm-project/commit/f2be7bed1be336aff40e87a7947b9aff676e237a), support for global values was added to the large code model to address the bug mentioned in (https://bugs.llvm.org/show_bug.cgi?id=35958).
However, after the commit (https://github.com/llvm/llvm-project/commit/ca68038d12a23fa7ebb2b1ccbda93c321635e6bf) that turned on the default PIE option, the code cannot be compiled correctly without PIC.
For example, when trying to compile the following code with the command `clang -mcmodel=large test.c`:
```c
#define BIG (1024*1024*1024)
int foo1[BIG];
int foo2[BIG];
int main(void)
{
return foo1[0] + foo2[0];
}
```
The following error occurs:
```cmd
/usr/bin/aarch64-linux-gnu-ld: /tmp/test-c9e810.o: relocation R_AARCH64_MOVW_UABS_G0_NC against `foo1' can not be used when making a shared object; recompile with -fPIC
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
```
This error is due to the absence of Position Independent Code, which is required when creating shared objects.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs