* realocatable code
@ 2001-01-22 2:21 Gerhard TAEUBL
0 siblings, 0 replies; only message in thread
From: Gerhard TAEUBL @ 2001-01-22 2:21 UTC (permalink / raw)
To: gcc-help
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 9116 bytes --]
Hallo!
I have to compiled code realocate able. So I use the following
makefile:
Â
$(BUILD_DIR)/%.o: %.c  $(CC) -g -c -Wall -W -mrelocatable -o
$@ $<
Â
$(BUILD_DIR)/%.o : %.s  $(AS) -o $@ $<
Â
$(ELF_FILE): $(O_FILES) ../src/$(LINK_FILE) Â $(LD)
-nostartfiles -T ../src/$(LINK_FILE) -Map
$(MAP_FILE)\ Â Â Â Â Â Â -o $(ELF_FILE)
$(O_FILES)
Â
$(TMP_FILE): $(ELF_FILE) Â $(OBJCOPY) --strip-all --strip-debug
--remove-section .comment\ Â Â Â --output-target binary
$(ELF_FILE) $(TMP_FILE)
Â
$(BIN_FILE): $(TMP_FILE) Â $(PERL) $(MODCRC32) $(TMP_FILE)
$(BUILD_DIR)/lmodule.tmp  $(PERL) $(SBUS_DL) $(BUILD_DIR)/lmodule.tmp
$(BIN_FILE) Â $(RM) $(BUILD_DIR)/lmodule.tmp $(TMP_FILE)
 Well this works fine with:
as 2.8.1
gcc 2.7.2.1
ld 2.8.1
(I know this compiler is a little bit too old.. :-) )
Then I update to:
as 2.9.1
gcc 2.91.57
ld 2.9.1
Â
After that I get an error message:
/project/v4/software/ext-tools/egcs-1.1b-newlib/bin/powerpc-eabi-gcc -g
-c -Wall -W -mrelocatable -o ../build/lmodule.o lmodule.c lmodule.c: In function
`EventHandler': lmodule.c:267: warning: unused parameter
`Event' /project/v4/software/ext-tools/egcs-1.1b-newlib/bin/powerpc-eabi-as
-o ../build/iotable.o iotable.s
/project/v4/software/ext-tools/egcs-1.1b-newlib/bin/powerpc-eabi-ld
-nostartfiles -r -T ../src/lmodule.lnk -Map
../build/lmodule.map\ Â Â Â Â Â -o
../build/lmodule.elf ../build/lmodule.oÂ
../build/iotable.o /project/v4/software/ext-tools/egcs-1.1b-newlib/bin/powerpc-eabi-ld:
../build/lmodule.o: compiled with -mrelocatable and linked with modules compiled
normally Bad value: failed to merge target specific data of file
../build/lmodule.o make: *** [../build/lmodule.elf] Error 1
If I use the old linker everthing is fine, so whats wrong?
Â
Here is the linker file:
ENTRY( InitModule)
Â
OUTPUT_FORMAT("elf32-powerpc",
"elf32-powerpc", Â Â Â Â Â Â Â Â Â Â Â Â Â
"elf32-powerpc") OUTPUT_ARCH(powerpc)
Â
SECTIONS { Â Â .iotable : Â Â
{ Â Â Â Â Â
../build/iotable.o(.data)Â Â Â Â Â Â Â
}
Â
  .text :  Â
{ Â Â Â Â Â
../build/lmodule.o(.text) Â Â Â Â Â
*(.text) Â Â Â Â Â /* .gnu.warning sections are handled
specially by elf32.em. */     Â
*(.gnu.warning) Â Â } =0
Â
__IMAGE_START = ADDR(.text); __TSTRAM_START =
__IMAGE_START;
Â
 Â
.init            Â
: { *(.init)Â Â Â Â Â Â Â Â Â }
=0 Â Â
.fini            Â
: { *(.fini)Â Â Â Â Â Â Â Â Â }
=0
Â
  /* Read-only sections, merged into text segment:
*/ Â Â
.interp           : {
*(.interp)Â Â Â Â Â Â Â } Â Â
.hash            Â
: { *(.hash)Â Â Â Â Â Â Â Â Â
} Â Â
.dynsym           : {
*(.dynsym)Â Â Â Â Â Â Â } Â Â
.dynstr           : {
*(.dynstr)Â Â Â Â Â Â Â } Â Â
.rela.text        : {
*(.rela.text)Â Â Â Â } Â Â
.rela.data        : {
*(.rela.data)Â Â Â Â } Â Â
.rela.rodata      : { *(.rela.rodata) Â
} Â Â
.rela.got         : {
*(.rela.got)Â Â Â Â Â } Â Â
.rela.got1Â Â Â Â Â Â Â Â : {
*(.rela.got1)Â Â Â Â } Â Â
.rela.got2Â Â Â Â Â Â Â Â : {
*(.rela.got2)Â Â Â Â } Â Â
.rela.ctors       : {
*(.rela.ctors)Â Â Â } Â Â
.rela.dtors       : {
*(.rela.dtors)Â Â Â } Â Â
.rela.init        : {
*(.rela.init)Â Â Â Â } Â Â
.rela.fini        : {
*(.rela.fini)Â Â Â Â } Â Â
.rela.bss         : {
*(.rela.bss)Â Â Â Â Â } Â Â
.rela.plt         : {
*(.rela.plt)Â Â Â Â Â } Â Â
.rela.sdata       : {
*(.rela.sdata2)Â Â } Â Â
.rela.sbss        : {
*(.rela.sbss2)Â Â Â } Â Â
.rela.sdata2Â Â Â Â Â Â : { *(.rela.sdata2)Â Â
} Â Â .rela.sbss2Â Â Â Â Â Â Â : {
*(.rela.sbss2)Â Â Â } Â Â
.plt             Â
: { *(.plt)Â Â Â Â Â Â Â Â Â Â
}
Â
 Â
.rodata           : {
*(.rodata)Â Â Â Â Â Â Â } Â Â
.rodata1Â Â Â Â Â Â Â Â Â Â : {
*(.rodata1)Â Â Â Â Â Â }
Â
 Â
.sdata2Â Â Â Â Â Â Â Â Â Â Â : {
*(.sdata2)Â Â Â Â Â Â Â } Â Â
.sbss2Â Â Â Â Â Â Â Â Â Â Â Â :
{ *(.sbss2)Â Â Â Â Â Â Â Â }
Â
__DATA_RAM = .; __DATA_ROM = __DATA_RAM;
Â
 Â
.data            Â
: Â Â { Â Â Â Â Â
*(.data) Â Â Â Â Â CONSTRUCTORS Â Â
} Â Â
.data1Â Â Â Â Â Â Â Â Â Â Â Â :
{ *(.data1)Â Â Â Â Â Â Â Â } Â Â
.got1Â Â Â Â Â Â Â Â Â Â Â Â Â
: { *(.got1)Â Â Â Â Â Â Â Â Â
} Â Â
.dynamic          : {
*(.dynamic)Â Â Â Â Â Â } Â Â /* Put .ctors
and .dtors next to the .got2 section, so that the
pointers      get relocated with -mrelocatable.
Also put in the .fixup pointers. Â Â Â Â Â The current
compiler no longer needs this, but keep it around for 2.7.2Â
*/ Â Â PROVIDE (_GOT2_START_ = .); Â Â
.got2Â Â Â Â Â Â Â Â Â Â Â Â Â
:Â { *(.got2)Â Â Â Â Â Â Â Â
} Â Â PROVIDE (__CTOR_LIST__ = .); Â Â
.ctors            :
{ *(.ctors)Â Â Â Â Â Â Â Â } Â Â
PROVIDE (__CTOR_END__ = .); Â Â PROVIDE (__DTOR_LIST__ =
.); Â Â
.dtors            :
{ *(.dtors)Â Â Â Â Â Â Â Â } Â Â
PROVIDE (__DTOR_END__ = .); Â Â PROVIDE (_FIXUP_START_ =
.); Â Â
.fixup            :
{ *(.fixup)Â Â Â Â Â Â Â Â } Â Â
PROVIDE (_FIXUP_END_ = .); Â Â PROVIDE (_GOT2_END_ =
.); Â Â PROVIDE (_GOT_START_ = .); Â Â
.got             Â
: { *(.got)Â Â Â Â Â Â Â Â Â Â
} Â Â
.got.plt          : {
*(.got.plt)Â Â Â Â Â Â } Â Â PROVIDE
(_GOT_END_ = .); Â Â /* We want the small data sections together, so
single-instruction offsets      can access them
all, and initialized data all before uninitialized,
so      we can shorten the on-disk segment
size. */  Â
.sdata            :
{ *(.sdata)Â Â Â Â Â Â Â Â }
Â
__DATA_ENDÂ Â Â Â Â =
.; __IMAGE_SIZEÂ Â Â = __DATA_END -
__IMAGE_START; __BSS_STARTÂ Â Â Â = .;
Â
 Â
.sbss            Â
: Â Â { Â Â Â Â Â
*(.sbss) Â Â Â Â Â *(.scommon) Â Â
} Â Â
.bss             Â
: Â Â { Â Â Â Â Â
*(.dynbss) Â Â Â Â Â
*(.bss) Â Â Â Â Â *(COMMON) Â Â }
Â
__BSS_ENDÂ Â Â Â Â Â = .;
Â
  /* These are needed for ELF backends which have not yet
been      converted to the new style linker.Â
*/ Â Â
.stab          0 : {
*(.stab)Â Â Â Â Â Â Â Â Â } Â Â
.stabstr       0 : {
*(.stabstr)Â Â Â Â Â Â }
Â
  /* DWARF debug sections.     Â
Symbols in the .debug DWARF section are relative to the beginning of
the      section so we begin .debug at 0.Â
It's not clear yet what needs to happen      for
the others.  */  Â
.debug         0 : {
*(.debug)Â Â Â Â Â Â Â Â Â
}   .debug_srcinfo 0 : { *(.debug_srcinfo)Â
}   .debug_aranges 0 : { *(.debug_aranges)Â
} Â Â .debug_pubnames 0 : { *(.debug_pubnames) } Â Â
.debug_sfnames 0 : { *(.debug_sfnames) }  Â
.line          0 : {
*(.line)Â Â Â Â Â Â Â Â Â Â
} }
Â
Could anyone help me?
Thanks
Gerhard
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-01-22 2:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-22 2:21 realocatable code Gerhard TAEUBL
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).