Giter Site home page Giter Site logo

Comments (11)

igrr avatar igrr commented on July 25, 2024

Assembler on its own doesn't support C preprocesor directives like #include. When you compile an assembly source file using GCC, there is an option to automatically run the source file through C preprocesor before passing it to the assembler. By default, GCC decides whether to do this or not based on the file extension. Assembly source files with .S extension are passed through the preprocesor, source files with .s extension are not. You can override this behavior using -x assembler-with-cpp option.

from crosstool-ng.

myan-o avatar myan-o commented on July 25, 2024

Where should I set it? If I set it to "CT_EXTRA_CFLAGS_FOR_BUILD" or "CT_EXTRA_CFLAGS_FOR_HOST", I get a syntax error when compiling test.c.

Are there instructions for building xtensa-esp32s3-elf?

from crosstool-ng.

igrr avatar igrr commented on July 25, 2024

Could you please describe what you are trying to do? What is the contents of test.c? What command are you running to compile it?

from crosstool-ng.

myan-o avatar myan-o commented on July 25, 2024

Could you please describe what you are trying to do? What is the contents of test.c? What command are you running to compile it?

the contents of test.c
int main() { return 0; }

from crosstool-ng.

myan-o avatar myan-o commented on July 25, 2024

build options

if [ uname -o == "Android" ]
then
config_value "$CT_CONFIG_FILE" "CT_CFLAGS_FOR_BUILD" "-I${PREFIX}/include -fPIE"
config_value "$CT_CONFIG_FILE" "CT_LDFLAGS_FOR_BUILD" "-L${PREFIX}/lib -fPIE -pie"
config_value "$CT_CONFIG_FILE" "CT_EXTRA_CFLAGS_FOR_BUILD" "-I${PREFIX}/include -fPIE"
config_value "$CT_CONFIG_FILE" "CT_EXTRA_LDFLAGS_FOR_BUILD" "-L${PREFIX}/lib -fPIE -pie"
config_value "$CT_CONFIG_FILE" "CT_EXTRA_CFLAGS_FOR_HOST" "-I${PREFIX}/include -fPIE"
config_value "$CT_CONFIG_FILE" "CT_EXTRA_LDFLAGS_FOR_HOST" "-L${PREFIX}/lib -fPIE -pie"
config_append "$CT_CONFIG_FILE" ".*_EXTRA_CONFIG_ARRAY" "\2 --with-gnu-ld --disable-__cxa_atexit --without-headers"
fi

config_value "$CT_CONFIG_FILE" "CT_HOST" "$CT_HOST"
config_value "$CT_CONFIG_FILE" "CT_BUILD" "$CT_BUILD"
config_value "$CT_CONFIG_FILE" "CT_WORK_DIR" "$CT_WORK_DIR"
config_value "$CT_CONFIG_FILE" "CT_BUILD_TOP_DIR" "${CT_WORK_DIR}/${CT_TARGET}"
config_value "$CT_CONFIG_FILE" "CT_SRC_DIR" "${CT_BUILD_TOP_DIR}/src"
config_enable "$CT_CONFIG_FILE" "CT_DEBUG_CT_SAVE_STEPS"
config_append "$CT_CONFIG_FILE" ".*_EXTRA_CONFIG_ARRAY" "\2 --disable-bootstrap --disable-werror"
config_append "$CT_CONFIG_FILE" "CT_EXTRA_CFLAGS_FOR_BUILD" "\2 -x assembler-with-cpp"
config_append "$CT_CONFIG_FILE" "CT_EXTRA_CFLAGS_FOR_HOST" "\2 -x assembler-with-cpp"

config_enable "$CT_CONFIG_FILE" "CT_EXPERIMENTAL"
config_enable "$CT_CONFIG_FILE" "CT_ALLOW_BUILD_AS_ROOT"
config_enable "$CT_CONFIG_FILE" "CT_ALLOW_BUILD_AS_ROOT_SURE"
}

from crosstool-ng.

myan-o avatar myan-o commented on July 25, 2024

Even if the -x assembler-with-cpp option is specified, an error occurs.

cd crosstool-NG/
.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/build
/build-cc-gcc-core/xtensa-esp32s3-elf/libgcc

make

# If this is the top-level multilib, build all the other
# multilibs.
make[1]: Entering directory '/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/build/build-cc-gcc-core/xtensa-esp32s3-elf/libgcc'
make[2]: Entering directory '/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/build/build-cc-gcc-core/xtensa-esp32s3-elf/esp32-psram/libgcc'
# If this is the top-level multilib, build all the other
# multilibs.
/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/build/build-cc-gcc-core/./gcc/xgcc -B/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/build/build-cc-gcc-core/./gcc/ -B/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/buildtools/xtensa-esp32s3-elf/bin/ -B/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/buildtools/xtensa-esp32s3-elf/lib/ -isystem /data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/buildtools/xtensa-esp32s3-elf/include -isystem /data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/buildtools/xtensa-esp32s3-elf/sys-include    -g -O2 -mlongcalls -idirafter /data/data/com.termux/files/home/git/crosstool-NG/builds/xtensa-esp32s3-elf/xtensa-esp32s3-elf/include -g -Os -x assembler-with-cpp -mfix-esp32-psram-cache-issue -O2  -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -mlongcalls -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -mlongcalls -I. -I. -I../../.././gcc -I/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/src/gcc/libgcc -I/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/src/gcc/libgcc/. -I/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/src/gcc/libgcc/../gcc -I/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/src/gcc/libgcc/../include  -DHAVE_CC_TLS  -x assembler-with-cpp  -o _addsubsf3_s.o -MT _addsubsf3_s.o -MD -MP -MF _addsubsf3_s.dep -DSHARED -DL_addsubsf3 -xassembler-with-cpp -c /data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/src/gcc/libgcc/config/xtensa/lib1funcs.S
/data/data/com.termux/files/usr/tmp/ccoYgST1.s: Assembler messages:
/data/data/com.termux/files/usr/tmp/ccoYgST1.s:18: Error: unknown opcode or format name 'leaf_return'
/data/data/com.termux/files/usr/tmp/ccoYgST1.s:28: Error: unknown opcode or format name 'leaf_return'
/data/data/com.termux/files/usr/tmp/ccoYgST1.s:34: Error: unknown opcode or format name 'leaf_return'
/data/data/com.termux/files/usr/tmp/ccoYgST1.s:52: Error: unknown opcode or format name 'leaf_return'
/data/data/com.termux/files/usr/tmp/ccoYgST1.s:62: Error: unknown opcode or format name 'leaf_return'
/data/data/com.termux/files/usr/tmp/ccoYgST1.s:74: Error: unknown opcode or format name 'leaf_entry'
/data/data/com.termux/files/usr/tmp/ccoYgST1.s:148: Error: unknown opcode or format name 'leaf_return'
/data/data/com.termux/files/usr/tmp/ccoYgST1.s:190: Error: unknown opcode or format name 'leaf_return'
/data/data/com.termux/files/usr/tmp/ccoYgST1.s:203: Error: unknown opcode or format name 'leaf_return'
/data/data/com.termux/files/usr/tmp/ccoYgST1.s:214: Error: unknown opcode or format name 'do_nsau'
/data/data/com.termux/files/usr/tmp/ccoYgST1.s:239: Error: unknown opcode or format name 'leaf_return'
make[2]: *** [Makefile:491: _addsubsf3_s.o] Error 1
make[2]: Leaving directory '/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/build/build-cc-gcc-core/xtensa-esp32s3-elf/esp32-psram/libgcc'
make[1]: *** [Makefile:1211: multi-do] Error 1
make[1]: Leaving directory '/data/data/com.termux/files/home/git/crosstool-NG/.build-xtensa-esp32s3-elf/xtensa-esp32s3-elf/build/build-cc-gcc-core/xtensa-esp32s3-elf/libgcc'
make: *** [Makefile:127: all-multi] Error 2

from crosstool-ng.

myan-o avatar myan-o commented on July 25, 2024

After removing -DL_addsubsf3, the compilation went through.

from crosstool-ng.

myan-o avatar myan-o commented on July 25, 2024

Macro definition in lib1funcs.S doesn't seem to work

from crosstool-ng.

myan-o avatar myan-o commented on July 25, 2024

It seems that the macro is not visible in #include "ieee754-sf.S".

from crosstool-ng.

myan-o avatar myan-o commented on July 25, 2024

If the file has a large number of characters, it seems to cause a macro undefined error. Is there a limit to the buffer size?

from crosstool-ng.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.