Skip to content
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

Fails to build with clang #29

Open
kraj opened this issue Jan 14, 2021 · 0 comments
Open

Fails to build with clang #29

kraj opened this issue Jan 14, 2021 · 0 comments

Comments

@kraj
Copy link

kraj commented Jan 14, 2021

I was trying to use clang cross compiler to build it and it showed up two issues

  1. Use gcc specific commandline option -mexplicit-relocs in Makefile
  2. Fails to compile code using atomics
ux00boot/ux00boot.c:505:3: error: address argument to atomic operation must be a pointer to _Atomic type ('volatile uint32_t *' (aka 'volatile unsigned int *') inval
id)                                                                               
  atomic_fetch_or(&GPIO_REG(GPIO_OUTPUT_VAL), UX00BOOT_ERROR_LED_GPIO_MASK);                                                                                         
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/u540-c000-bootloader/gitAUTOINC+128f282d17-r0/recipe-sysroot-native/usr/lib/clang/11.0.1/include/stdatomic.h:138:4
2: note: expanded from macro 'atomic_fetch_or'                         
#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)                                                               
                                         ^                     ~~~~~~
ux00boot/ux00boot.c:506:3: error: address argument to atomic operation must be a pointer to _Atomic type ('volatile uint32_t *' (aka 'volatile unsigned int *') inval
id)                                                                                                                                                                  
  atomic_fetch_or(&GPIO_REG(GPIO_OUTPUT_EN), UX00BOOT_ERROR_LED_GPIO_MASK);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                           
/mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/u540-c000-bootloader/gitAUTOINC+128f282d17-r0/recipe-sysroot-native/usr/lib/clang/11.0.1/include/stdatomic.h:138:4
2: note: expanded from macro 'atomic_fetch_or'
#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                         ^                     ~~~~~~
ux00boot/ux00boot.c:507:3: error: address argument to atomic operation must be a pointer to _Atomic type ('volatile uint32_t *' (aka 'volatile unsigned int *') inval
id)                                                                               
  atomic_fetch_or(&GPIO_REG(GPIO_OUTPUT_XOR), UX00BOOT_ERROR_LED_GPIO_MASK);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/u540-c000-bootloader/gitAUTOINC+128f282d17-r0/recipe-sysroot-native/usr/lib/clang/11.0.1/include/stdatomic.h:138:4
2: note: expanded from macro 'atomic_fetch_or'          
#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                         ^                     ~~~~~~                                                                                                
3 errors generated.
ux00boot/ux00boot.c:505:3: error: address argument to atomic operation must be a pointer to _Atomic type ('volatile uint32_t *' (aka 'volatile unsigned int *') inval
id)
  atomic_fetch_or(&GPIO_REG(GPIO_OUTPUT_VAL), UX00BOOT_ERROR_LED_GPIO_MASK);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/u540-c000-bootloader/gitAUTOINC+128f282d17-r0/recipe-sysroot-native/usr/lib/clang/11.0.1/include/stdatomic.h:138:4
2: note: expanded from macro 'atomic_fetch_or'
#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                         ^                     ~~~~~~
make: *** [Makefile:62: zsbl/ux00boot.o] Error 1
make: *** Waiting for unfinished jobs.... 
ux00boot/ux00boot.c:506:3: error: address argument to atomic operation must be a pointer to _Atomic type ('volatile uint32_t *' (aka 'volatile unsigned int *') inval
id)
  atomic_fetch_or(&GPIO_REG(GPIO_OUTPUT_EN), UX00BOOT_ERROR_LED_GPIO_MASK);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/u540-c000-bootloader/gitAUTOINC+128f282d17-r0/recipe-sysroot-native/usr/lib/clang/11.0.1/include/stdatomic.h:138:4
2: note: expanded from macro 'atomic_fetch_or'
#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                         ^                     ~~~~~~
ux00boot/ux00boot.c:507:3: error: address argument to atomic operation must be a pointer to _Atomic type ('volatile uint32_t *' (aka 'volatile unsigned int *') inval
id)
  atomic_fetch_or(&GPIO_REG(GPIO_OUTPUT_XOR), UX00BOOT_ERROR_LED_GPIO_MASK);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/u540-c000-bootloader/gitAUTOINC+128f282d17-r0/recipe-sysroot-native/usr/lib/clang/11.0.1/include/stdatomic.h:138:4
2: note: expanded from macro 'atomic_fetch_or'
#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                         ^                     ~~~~~~
3 errors generated.
make: *** [Makefile:68: fsbl/ux00boot.o] Error 1
fsbl/main.c:129:5: error: second parameter of 'main' (argument array) must be of type 'char **'
int main(int id, unsigned long dtb)
    ^
fsbl/main.c:276:3: error: address argument to atomic operation must be a pointer to _Atomic type ('volatile uint32_t *' (aka 'volatile unsigned int *') invalid)
  atomic_fetch_or(&GPIO_REG(GPIO_OUTPUT_VAL), PHY_NRESET);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/u540-c000-bootloader/gitAUTOINC+128f282d17-r0/recipe-sysroot-native/usr/lib/clang/11.0.1/include/stdatomic.h:138:4
2: note: expanded from macro 'atomic_fetch_or'
#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
                                         ^                     ~~~~~~
fsbl/main.c:277:3: error: address argument to atomic operation must be a pointer to _Atomic type ('volatile uint32_t *' (aka 'volatile unsigned int *') invalid)
  atomic_fetch_or(&GPIO_REG(GPIO_OUTPUT_EN),  PHY_NRESET);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant