Subject: No bss cause strange values in insmod and ELF

From: Shay Deloya <[email-masked]>
Date: Thu, 10 May 2001 09:10:45 +0300

----------  Forwarded Message  ----------
Subject: no bss cause strange values in insmod and ELF
Date: Wed, 9 May 2001 09:47:05 +0300
From: Shay Deloya <[email-masked]>
To: [email-masked]

Continuing my previous problem...

I have created a module with no bss , and compiled it with kernel 2.2.
Comparing this module with same code that has bss and acts OK.

Inserting the module with modutiles 2.2.2/ busybox insmod causes
a relocation overflow message , the reasons are:

1.in function obj_relocate: corrupted intsym->secidx value
  (not the needed index in the ELF)
   for some .text segments, other segments get their index value OK.
  the ELF file seems to be OK.
2. in function arch_apply_relocation: the wrong index (secidx=1006a1e8)
   cause R_MIPS_26 symbols (jump commands) to have the value of
   obj_reloc_overflow and then causes relocation overflow.

Does anyone knows why same module that has a variable in bss acts fine
 and the one without bss causes Relocation overflow in MIPS ? (in x86 there
is no problem).

Searching the code I see there is no initialization of the secidx ,
 is it a problem of wrong reading of ELF files by insmod ?

Attached the two ELF files , and obj_relocate values.

Thanks,
Shay Deloya
______________________________________
Software Developer
Jungo - R&D
email: [email-masked]
web: http://www.jungo.com
Phone: 1-877-514-0537(USA)  +972-9-8859365(Worldwide) ext. 221
Fax:   1-877-514-0538(USA)  +972-9-8859366(Worldwide)

-------------------------------------------------------

-- 
Shay Deloya
______________________________________
Software Developer
Jungo - R&D
email: [email-masked]
web: http://www.jungo.com
Phone: 1-877-514-0537(USA)  +972-9-8859365(Worldwide) ext. 221
Fax:   1-877-514-0538(USA)  +972-9-8859366(Worldwide)

---

From: "Tommy S. Christensen" <[email-masked]>
Date: Thu, 10 May 2001 23:11:18 +0200

> Attached the two ELF files , and obj_relocate values.

I had a look at the attachments and I think the cause of your problem is 
that the module is not a relocatable file!

ld can fix this for you. Try ld -r -o new.o <modulename>.o, and then 
insert new.o instead.

Regarding the effect of empty/non-empty .bss section (and of recompiling
modutils), I think this is just a case of "fix by accident". Meaning
that
it's still broke - it just didn't die (this time).

Regards,
Tommy Christensen