Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto | Site FAQ | Sitemap | Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
|Introduction to Linux — A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author’s experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
My c code on compiling on gcc is giving the error Cannot find entry symbol _start defaulting to 00000 . Can anyone tell me why and how to correct it?
The command line is arm-none-eabi-gcc -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp file path and the target platform is a-8 sitara cortex processor.
2 Answers 2
The only reason the compiler threw the above error is because the start code(_start function) generated by the OS for running your code cannot find the default or registered function main. So either you can use _start function instead of main function but the compilation command should be gcc -nostartfiles filename.c but using _start there are a lot of exceptions so better to use main instead.
the -none- part means that your toolchain doesn’t build for a particular operating system, so you must define a _start entry point. For non-bare-metal toolchains that build for a particular operating system, _start is provided by the standard library that in order will call main when everything is set up.
Not the answer you’re looking for? Browse other questions tagged gcc or ask your own question.
Hot Network Questions
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2019 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2019.11.15.35459
I’m learning assembly programming. Below is the simple program that prints ‘Hello, World!’. While the program runs perfectly, I’m getting the warning message while loading
Here is the code :
Can anybody explain the meaning of this warning. I’m using nasm with ubuntu 14 .
6 Answers 6
You don’t say, but from the error messages and code I assume you’re building your 32bit code with nasm -felf32 hello32.asm && ld -melf_i386 -o hello32 hello32.o
(If you’re actually building 64bit code, you’re lucky that it happens to work, but it’ll break as soon as you do anything with esp instead of rsp .)
The error message is from ld , not from nasm . It says so right in the message. Tim’s comment is correct: ld looks for a _start symbol in the files it links, but sets the entry point to the beginning of the text segment if it doesn’t find one.
It doesn’t matter what other global/external symbols you define. main has no relevance at all here, and could point anywhere you want. It’s only useful for a disassembly output and stuff like that. Your code would work exactly the same if you took out the global main / main: lines, or changed them to any other name.
Labelling that as main is unwise, if you’re building without the standard libc runtime start files. It’s not main() , and doesn’t receive argc and argv arguments. (Or maybe the 32bit ABI does put those on the stack at process start time, in the same order main() wants them. The 64bit ABI puts them on the stack, but the startup code that calls main has to load them into registers because 64bit uses a register-call ABI.) You also can’t return from the entry point: there’s no return address on the stack.