This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Linker script: Usage of INCLUDE and EXCLUDE_FILE + SORT_BY_ALIGNMENT/SORT_BY_NAME?


Hi,

I've two questions regarding the usage of INCLUDE and EXCLUDE_FILE in a linker script:

1. I have some statements like this:

.text    :
{
    file1.o
    file2.o
    (.text)
}

This does work. As I have to use the list of files in different sections (.data, .rodata etc) I'd like to put the file list into a separate file and include this file using INCLUDE. E.g.

.text:
{
    INCLUDE file.lst
    (.text)
}

with file.lst just:

file1.o
file2.o

Everything I could get with this until now was 'syntax error' :(

How can I correctly include a list of files? If INCLUDE is wrong, is there any other option to not repeat the list of files in each section?


2. An existing linker file uses SORT_BY_ALIGNMENT/SORT_BY_NAME:


.data : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.data*))) }

Now, I want to exclude some files from being used for this data section with EXCLUDE_FILE. E.g.

.data :
{
    *(EXCLUDE_FILE (file1.o
            file2.o)
            .data*)
}

This does work. But the SORT_BY_ALIGNMENT/SORT_BY_NAME is still missing then. I couldn't figure where to place the SORT_BY_ALIGNMENT/SORT_BY_NAME in combination with EXCLUDE_FILE to get something else than 'syntax error', again.

How has above statement to look like adding SORT_BY_ALIGNMENT/SORT_BY_NAME ?


Many thanks for the help!


Dirk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]