Thread: Linker scripts

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    1

    Linker scripts

    What are Linker Scripts? How to write them?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    The manual doesn't give a good idea of WHY you would use a linker script.

    A linker script lets you do three main things:

    1. You can define new symbols at link time. These are simple variables that take on numeric values that can only be calculated at link time. For instance, if you wanted a variable which contained the size of the .text section, you could do this via linker script directives.
    2. You can control the mapping from input sections to output sections. For instance, you can cause all of the .text from a specific object to go into a special section separate from the rest of the code. Or you could tell the linker to place all sections into one big section with no distinction between them.
    3. You can control the exact layout of the sections, both in terms of their position in the output file as well as their position in virtual memory once they have been loaded.

    All of these are very special-purpose tasks.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I need Help with scripts for a game!
    By LubuKage in forum Game Programming
    Replies: 5
    Last Post: 07-12-2010, 07:27 PM
  2. about cgi scripts
    By xixpsychoxix in forum Networking/Device Communication
    Replies: 11
    Last Post: 07-08-2008, 06:03 PM
  3. C++ for CGI scripts
    By sean in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 01-03-2003, 10:53 AM
  4. Linux scripts
    By billholm in forum Linux Programming
    Replies: 7
    Last Post: 07-07-2002, 11:37 PM
  5. CGI scripts in c/c++ ?
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 09-14-2001, 01:24 PM

Tags for this Thread