crust-firmware / crust

SCP (power management) firmware for sunxi SoCs
Other
150 stars 34 forks source link

Fails to build due RWX segment warning #212

Closed Kreyren closed 1 year ago

Kreyren commented 1 year ago
[user@16f0ec0ae71c crust-588aef2a0f687fd84b8c7c37402c6006b6c1cc7f]$ grep -r rwx
arch/or1k/scp.ld.S:  SRAM_A2 (rwx): ORIGIN = SRAM_A2_BASE, LENGTH = SRAM_A2_SIZE
build/scp/arch/or1k/scp.ld.o:  SRAM_A2 (rwx): ORIGIN = 0x00000000, LENGTH = (0x00014000 - 0x00000000)
[user@16f0ec0ae71c crust-588aef2a0f687fd84b8c7c37402c6006b6c1cc7f]$ make 
  LD      build/scp/scp.elf
/usr/lib/gcc/or1k-elf/12.2.0/../../../../or1k-elf/bin/ld: warning: build/scp/scp.elf has a LOAD segment with RWX permissions
collect2: error: ld returned 1 exit status
make: *** [Makefile:197: build/scp/scp.elf] Error 1

Supresing the warning with LDFLAGS="--no-warn-rwx-segments" doesn't affect the outcome.

[user@16f0ec0ae71c crust-588aef2a0f687fd84b8c7c37402c6006b6c1cc7f]$ make CROSS_COMPILE=or1k-elf- scp
  LD      build/scp/scp.elf
/usr/lib/gcc/or1k-elf/12.2.0/../../../../or1k-elf/bin/ld: warning: build/scp/scp.elf has a LOAD segment with RWX permissions
collect2: error: ld returned 1 exit status
make: *** [Makefile:197: build/scp/scp.elf] Error 1
[user@16f0ec0ae71c crust-588aef2a0f687fd84b8c7c37402c6006b6c1cc7f]$ LDFLAGS="--no-warn-rwx-segments" CROSS_COMPILE=or1k-elf- make scp
  LD      build/scp/scp.elf
/usr/lib/gcc/or1k-elf/12.2.0/../../../../or1k-elf/bin/ld: warning: build/scp/scp.elf has a LOAD segment with RWX permissions
collect2: error: ld returned 1 exit status
make: *** [Makefile:197: build/scp/scp.elf] Error 1

CC @smaeul

bill-auger commented 1 year ago

probably a duplicate of #207 #209 #210 - watching #210

smaeul commented 1 year ago

Yes, fixed by ade7ad311170b8a818741944d97489c887cd673f.

LDFLAGS uses normal assignment (=, not ?=) in the Makefile, so it does not get overridden by the environment; LDFLAGS would only get overridden if you passed it as an argument to make. This is intentional, since the firmware is cross compiled.