Adjusting Seg Fault

robert baker robertmbaker at gmail.com
Wed May 5 17:47:58 PDT 2010


Alright, I'm getting back to this a little later than I expected to
but I have found the root of the issue. For completeness I am going to
give a brief rundown of my build environment.

I use Debian Lenny x86_64 on my work system. All of my builds happen
within VMware workstation 7 using an LFS live CD ISO. At the moment I
am building a 32bit HLFS, but I did notice the same issues building
for 64bit.

As the instructions stand now when building binutils and gcc
--enable-shared is used. This causes the segfault to occur with ld and
as. LFS uses --disable-shared on both packages as well as symlinking
libgcc_eh.a to libgcc.a which prevents this problem. I will update SVN
with this change later tonight.

RBaker

On Wed, Apr 28, 2010 at 9:35 AM, robert baker <robertmbaker at gmail.com> wrote:
> Up until last night I had been running into this brick wall too. I
> believe I have a series of changes that will fix this problem, but I
> am going to go through more testing to nail down exactly what was
> causing the segfault. More on this later in the week.
>
> On Mon, Mar 1, 2010 at 11:13 AM, Michael DeLuca <delucamd at gmail.com> wrote:
>> Yes, I am running the files as scripts.
>>
>> Before I start over, running strace shows that since it can't find a
>> tools version of libz it uses libz from my host system...  Could this
>> be causing the seg fault?
>>
>> strace output:
>>
>> execve("/hlfs-tools/bin/ld", ["ld"], [/* 11 vars */]) = 0
>> brk(0)                                  = 0x9e44000
>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
>> 0) = 0xb7781000
>> access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
>> open("/hlfs-tools/lib/tls/i686/sse2/libbfd-2.19.51.20090904.so",
>> O_RDONLY) = -1 ENOENT (No such file or directory)
>> stat64("/hlfs-tools/lib/tls/i686/sse2", 0xbffb74e8) = -1 ENOENT (No
>> such file or directory)
>> open("/hlfs-tools/lib/tls/i686/libbfd-2.19.51.20090904.so", O_RDONLY)
>> = -1 ENOENT (No such file or directory)
>> stat64("/hlfs-tools/lib/tls/i686", 0xbffb74e8) = -1 ENOENT (No such
>> file or directory)
>> open("/hlfs-tools/lib/tls/sse2/libbfd-2.19.51.20090904.so", O_RDONLY)
>> = -1 ENOENT (No such file or directory)
>> stat64("/hlfs-tools/lib/tls/sse2", 0xbffb74e8) = -1 ENOENT (No such
>> file or directory)
>> open("/hlfs-tools/lib/tls/libbfd-2.19.51.20090904.so", O_RDONLY) = -1
>> ENOENT (No such file or directory)
>> stat64("/hlfs-tools/lib/tls", 0xbffb74e8) = -1 ENOENT (No such file or
>> directory)
>> open("/hlfs-tools/lib/i686/sse2/libbfd-2.19.51.20090904.so", O_RDONLY)
>> = -1 ENOENT (No such file or directory)
>> stat64("/hlfs-tools/lib/i686/sse2", 0xbffb74e8) = -1 ENOENT (No such
>> file or directory)
>> open("/hlfs-tools/lib/i686/libbfd-2.19.51.20090904.so", O_RDONLY) = -1
>> ENOENT (No such file or directory)
>> stat64("/hlfs-tools/lib/i686", 0xbffb74e8) = -1 ENOENT (No such file
>> or directory)
>> open("/hlfs-tools/lib/sse2/libbfd-2.19.51.20090904.so", O_RDONLY) = -1
>> ENOENT (No such file or directory)
>> stat64("/hlfs-tools/lib/sse2", 0xbffb74e8) = -1 ENOENT (No such file
>> or directory)
>> open("/hlfs-tools/lib/libbfd-2.19.51.20090904.so", O_RDONLY) = 3
>> read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\2203\1\0004\0\0\0"...,
>> 512) = 512
>> fstat64(3, {st_mode=S_IFREG|0755, st_size=2750529, ...}) = 0
>> mmap2(NULL, 714640, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,
>> 0) = 0xb76d2000
>> mmap2(0xb7775000, 32768, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa2) = 0xb7775000
>> mmap2(0xb777d000, 14224, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb777d000
>> close(3)                                = 0
>> open("/hlfs-tools/lib/libz.so.1", O_RDONLY) = -1 ENOENT (No such file
>> or directory)
>> open("/etc/ld.so.cache", O_RDONLY)      = 3
>> fstat64(3, {st_mode=S_IFREG|0644, st_size=9850, ...}) = 0
>> mmap2(NULL, 9850, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb76cf000
>> close(3)                                = 0
>> open("/lib/libz.so.1", O_RDONLY)        = 3
>> read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320\25\0\0004\0\0\0"...,
>> 512) = 512
>> fstat64(3, {st_mode=S_IFREG|0755, st_size=82142, ...}) = 0
>> mmap2(NULL, 78924, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,
>> 0) = 0xb76bb000
>> mmap2(0xb76ce000, 4096, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12) = 0xb76ce000
>> close(3)                                = 0
>> open("/hlfs-tools/lib/libc.so.6", O_RDONLY) = 3
>> read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\272l\1\0004\0\0\0"...,
>> 512) = 512
>> fstat64(3, {st_mode=S_IFREG|0755, st_size=1727075, ...}) = 0
>> mmap2(NULL, 1428456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE,
>> 3, 0) = 0xb755e000
>> mprotect(0xb76b4000, 4096, PROT_NONE)   = 0
>> mmap2(0xb76b5000, 12288, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x156) = 0xb76b5000
>> mmap2(0xb76b8000, 11240, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb76b8000
>> close(3)                                = 0
>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
>> 0) = 0xb755d000
>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
>> 0) = 0xb755c000
>> set_thread_area({entry_number:-1 -> 6, base_addr:0xb755db20,
>> limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,
>> limit_in_pages:1, seg_not_present:0, useable:1}) = 0
>> mprotect(0xb76b5000, 8192, PROT_READ)   = 0
>> mprotect(0xb77a1000, 4096, PROT_READ)   = 0
>> munmap(0xb76cf000, 9850)                = 0
>> getrusage(RUSAGE_SELF, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 0
>> brk(0)                                  = 0x9e44000
>> --- SIGSEGV (Segmentation fault) @ 0 (0) ---
>> +++ killed by SIGSEGV +++
>> Segmentation fault
>>
>>
>> On Sun, Feb 28, 2010 at 4:55 PM, Robert Connolly
>> <robert at linuxfromscratch.org> wrote:
>>> On Sunday February 28 2010 06:21:54 pm Michael DeLuca wrote:
>>>> Trying to fix the warnings didn't help, I got the same error.  I
>>>> started over and found that ld and as that binutils builds work fine
>>>> up until glibc is built and installed.  If I run my tools/ld right
>>>> before building/installing glibc it outputs "ld: no input files"
>>>> After the glibc install it outputs: "Segmentation fault"  The same is
>>>> true for as.  I get the seg fault both before and after the toolchain
>>>> is adjusted...
>>>>
>>>> Any ideas?
>>>
>>> If this was me, I would run strace on /tools/bin/ld. If that doesn't turn up
>>> anything, like missing files, I would start over. At Glibc don't apply any
>>> patches or modifications. Do:
>>>
>>> ./configure --prefix=/tools --with-binutils=/tools/bin \
>>>        --with-headers=/tools/include --libexecdir=/tools/lib/glibc \
>>>        --enable-add-ons --enable-bind-now --enable-kernel=2.6.18 \
>>>        --disable-profile \
>>>        --without-gd --without-selinux --infodir=$(pwd)/DESTDIR \
>>>        --mandir=$(pwd)/DESTDIR &&
>>> echo "CFLAGS += -march=i486 -mtune=native" >> configparms &&
>>> make &&
>>> make install
>>>
>>> Omit --enable-omitfp --enable-stackguard-randomization for now, and see if
>>> that works. What cpu is this? Are you running the text files as shell
>>> scripts, like 'sh ../temporary_system/glibc.txt'?
>>>
>>> robert
>>>
>>> --
>>> http://linuxfromscratch.org/mailman/listinfo/hlfs-dev
>>> FAQ: http://www.linuxfromscratch.org/faq/
>>> Unsubscribe: See the above information page
>>>
>>>
>> --
>> http://linuxfromscratch.org/mailman/listinfo/hlfs-dev
>> FAQ: http://www.linuxfromscratch.org/faq/
>> Unsubscribe: See the above information page
>>
>



More information about the hlfs-dev mailing list