[clang] [llvm] Define pointer layout for AVR program address space (PR #134254)

Ben Shi via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 02:13:25 PDT 2025


benshi001 wrote:

Is this change necessary? I find there is not change in the size of addrspace 0/1 pointers, before and after your patch.

for program 
```c++
clang a.c --target=avr -mmcu=atmega2560
int gf(int a);
int (*p)(int) = gf;
int f;
int *p1 = &f;
```

the generated assembly is unique by before/after applying your patch.

```assembly
        .type   p, at object                       ; @p
        .data
        .globl  p
p:
        .short  pm(gf)
        .size   p, 2

        .type   f, at object                       ; @f
        .section        .bss,"aw", at nobits
        .globl  f
f:
        .short  0                               ; 0x0
        .size   f, 2

        .type   p1, at object                      ; @p1
        .data
        .globl  p1
p1:
        .short  f
        .size   p1, 2
```

https://github.com/llvm/llvm-project/pull/134254


More information about the llvm-commits mailing list