This is the mail archive of the ecos-bugs@sources.redhat.com mailing list for the eCos 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]

[Bug 1000088] New: -Wl,-n option should be added to link flags of all targets


http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000088

           Summary: -Wl,-n option should be added to link flags of all
                    targets
           Product: eCos
           Version: CVS
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: low
         Component: Other
        AssignedTo: jifl@ecoscentric.com
        ReportedBy: jifl@ecoscentric.com
         QAContact: ecos-bugs@sources.redhat.com
 BugsThisDependsOn: 1000035


The -Wl,-n option should be added to the link flags of every target. This either
means touching every platform HAL's CDL file, or waiting until this gets
centralised properly.

-Wl,-n should be at worst harmless and irrelevant for some targets, but some
need it and it would take some analysis to work out which ones so it is easier
to apply it in a blanket way. 

The issue is primarily on some targets the ELF PHDRs specify a load address for
a program to a notional maximum page size. On ARM this is 32K, on PowerPC and
SuperH it is 64K. This means that if you load a file in ELF format (e.g. using
RedBoot) within the same 32K or 64K etc. chunk as valid data, the valid data may
get overwritten.

For example the eb40a target program load address is 0xc000, but the linker will
generate an executable with a PHDR with the load address as 0x8000 because the
maximum page size for ARM is 0x8000. So although the intention was very much to
start at 0xc000 and not before (and not to waste memory by using 0x10000 instead
of 0xc000), the PHDR means that memory between 0x8000 and 0xc000 will get
overwritten. This is _not_ a bug (and I could go into more detail why, but it's
irrelevant), and for our requirements the right thing to do is add -Wl,-n. gcc
will pass through -n by itself but -Wl,-n is safer.



------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


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